Concurrency violation: the DeleteCommand

May 27 2016 7:12 AM
i am trying to update database after adding a row to a dataset but keep getting this error:
  • guage
  • Concurrency violation: the DeleteCommand affected 0 of the expected 1 records
i have not delete any rows just added one here is the code:
 
public void AddRow(System.Data.DataSet ds, string tablen, string[] info)
{
row = ds.Tables[tablen].NewRow();
row[0] = info[6];
row[1] = info[0];
row[2] = info[1];
row[3] = info[2];
row[4] = info[3];
row[5] = info[4];
row[6] = info[5];
ds.Tables[tablen].Rows.Add(row);
ds.Tables[tablen].DefaultView.Sort = "Date ASC";
objConnect.UpdateDatabase(ds, tablen);
}
 
 
public void UpdateDatabase(System.Data.DataSet ds, string tablen)
{
System.Data.SqlClient.SqlCommandBuilder cb = new System.Data.SqlClient.SqlCommandBuilder(da_1);
cb.DataAdapter.Update(ds, tablen);
}
 
 please help
 

Answers (1)