DataAdapter.Update acts strangely
I'm having a bit of a problem with the DataAdapter.Update method... I have a DataSet in which i modify some records but when i call the update method i get the DBConcurrencyException which says that there was nothing to modify (0 records affected by the update).
This is strange because i have verified that prior to calling the update method some records WERE modified and the correspondant rows had the RowState propery set to 'Modified'.
What could be the problem?
Thanks in advance.
Here are some details about how my program is actually working:
- i have a mainform (called MainForm) in which i added the connection to the database (it's a Access database with a single Table called Conturi), a dataadapter called DA_Conturi and a typed dataset (the class is called OPDataSet and the variable DS_Main)
- the table is DS_Main.Conturi and is also typed (OPDataSet.ConturiDataTable)
- i then have another form (a navigator) called ConturiNav to which i pass the table. the user accesses this form by a menu item in the MainForm called MI_Conturi
Here are the constructors for the two classes and the MI_Conturi_Click method which handles the click event on the menu item:
private System.Data.OleDb.OleDbDataAdapter DA_Conturi;
private OPDataSet DS_Main;
private void MI_Conturi_Click(object sender, System.EventArgs e)
ConturiNav cn=new ConturiNav(DS_Main.Conturi);
public OPDataSet.ConturiDataTable conturi;
public DataView dataview;
public ConturiNav(OPDataSet.ConturiDataTable conturi)
the error appears when the users edits the text in 'Sometextbox' and then closes the ConturiNav form.