Click here to Skip to main content
15,901,001 members

Comments by tommmyyy123 (Top 5 by date)

tommmyyy123 27-Sep-11 3:53am View    
In btnSave_Click and btnUpdate_Click I put the following code:
private void btnDelete_Click(object sender, EventArgs e)
{
System.Data.SqlClient.SqlCommandBuilder cb;
cb = new System.Data.SqlClient.SqlCommandBuilder(da);

DataSet ds1 = new DataSet();
da.Fill(ds1, "Workers");
//MessageBox.Show(i.ToString());
ds1.Tables["Workers"].Rows[i].Delete();
da.Update(ds1, "Workers");

MaxRows--;
i--;
NavigateRecords();
label4.Text = "Record " + (i+1).ToString() + " from " + MaxRows.ToString();
MessageBox.Show("Data Deleted");

}

and

private void btnUpdate_Click(object sender, EventArgs e)
{
System.Data.SqlClient.SqlCommandBuilder cb;
cb = new System.Data.SqlClient.SqlCommandBuilder(da);
DataSet ds1 = new DataSet();
da.Fill(ds1, "Workers");
DataRow dRowUp = ds1.Tables["Workers"].Rows[i];
dRowUp[1] = textBox1.Text;
dRowUp[2] = textBox2.Text;
dRowUp[3] = textBox3.Text;
da.Update(ds1, "Workers");
MessageBox.Show("Data Update");
label4.Text = "Record " + (i + 1).ToString() + " from " + MaxRows.ToString();
}


and now it's OK. Thank's
tommmyyy123 27-Sep-11 2:30am View    
I try this
tommmyyy123 27-Sep-11 2:29am View    
No, it's a good ideea
tommmyyy123 26-Sep-11 17:20pm View    
But, this error was heppend ONLY when I Add + Save +Delete record. If I want to delete any record, but not the last Add, the program work.
tommmyyy123 26-Sep-11 17:02pm View    
YES