OleDbData Adapter.Update Command Error
-
I've been trying to use the Update method of the OleDbDataAdapter to update a MS Access database, but have not had success. I'm updating a DataTable object through several data bound controls and want to update the database using the values in those bound controls by simply clicking a 'Save' button. The Update OleDbDataAdapter method seemed the most appropriate method to use, but it hasn't worked. I don't get an explicit error, but no changes are made to the source database. Would anyone be able to suggest a reason for this? Thanks.
-
I've been trying to use the Update method of the OleDbDataAdapter to update a MS Access database, but have not had success. I'm updating a DataTable object through several data bound controls and want to update the database using the values in those bound controls by simply clicking a 'Save' button. The Update OleDbDataAdapter method seemed the most appropriate method to use, but it hasn't worked. I don't get an explicit error, but no changes are made to the source database. Would anyone be able to suggest a reason for this? Thanks.
-
I assume that you assigned a command object to the UpdateCommand property of the DataAdapter. If you have done that, then please check if you have access to update the table.
How would I check if I have access?
-
How would I check if I have access?
-
If it's a windows application just try a simple update query and see if you can update it If it's a web application, try to give ASPNET account proper privileges
Thanks. Actually, that was not the problem. Basically, I wanted to use a DataGridView to display changes to the underlying data source, while using the data bound text box controls for editing purposes. Unfortunately, the way I set it up, the data table was not getting changed by changing the text box values. Still, I have encountered another problem, and that is a concurrency violation. What could be the source of the concurrency violation?
-
Thanks. Actually, that was not the problem. Basically, I wanted to use a DataGridView to display changes to the underlying data source, while using the data bound text box controls for editing purposes. Unfortunately, the way I set it up, the data table was not getting changed by changing the text box values. Still, I have encountered another problem, and that is a concurrency violation. What could be the source of the concurrency violation?
concurreny problem occurs when more than 1 users are trying to update the same record, it might happen that one will end up changing a record that has already been modified by other users. To fix concurrency violation, in your update query check if the record that you had read (and you're about to modify) has been modified or not. If it has been modified, don't update. Otherwise update it. This is called optimistic concurrency control.
-
concurreny problem occurs when more than 1 users are trying to update the same record, it might happen that one will end up changing a record that has already been modified by other users. To fix concurrency violation, in your update query check if the record that you had read (and you're about to modify) has been modified or not. If it has been modified, don't update. Otherwise update it. This is called optimistic concurrency control.
Thanks. I am certain that no other user is modifying the record. Could there be a concurrency violation because of some coding error?
-
Thanks. I am certain that no other user is modifying the record. Could there be a concurrency violation because of some coding error?