W
William LaMartin
In the past, I have filled a datagrid with data from an Access database
table using a data adapter and dataset, where I used the OleDbCommandBuilder
to have the program create the insert, delete and update commands
automatically for the dataadapter. I think those database tables had no
more than 10 or 12 fields. Then to save the changes in the datagrid to the
database, I simply evoked the dataadapter update command. No problems.
Yesterday, I tried the same scenario with a database someone sent me and had
no luck. When I should try to save the data after changes had been made in
the datagrid using the dataadapter update command, I got the following
error:
Update requires a valid UpdateCommand when passed DataRow collection with
modified rows.
Short of trying to write my own update command, I can find no way of
correcting this. By the way, this new database table has 22 fields. This
makes me wonder if the OleDbCommandBuilder goes flakey when you have more
than just a few fields?
Also, has anyone else encountered this and have a solution?
To get a program that would do what I needed, I added a reference to ADODB
to the project and used that to do my save with no problems. But I would
like to use the simpler solution of the dataadapter update.
table using a data adapter and dataset, where I used the OleDbCommandBuilder
to have the program create the insert, delete and update commands
automatically for the dataadapter. I think those database tables had no
more than 10 or 12 fields. Then to save the changes in the datagrid to the
database, I simply evoked the dataadapter update command. No problems.
Yesterday, I tried the same scenario with a database someone sent me and had
no luck. When I should try to save the data after changes had been made in
the datagrid using the dataadapter update command, I got the following
error:
Update requires a valid UpdateCommand when passed DataRow collection with
modified rows.
Short of trying to write my own update command, I can find no way of
correcting this. By the way, this new database table has 22 fields. This
makes me wonder if the OleDbCommandBuilder goes flakey when you have more
than just a few fields?
Also, has anyone else encountered this and have a solution?
To get a program that would do what I needed, I added a reference to ADODB
to the project and used that to do my save with no problems. But I would
like to use the simpler solution of the dataadapter update.