P
Peder Y
This might be a simple question, but I havent found a solution anywhere:
I do some stuff, and fill a DataSet from a database.
After the tables have been processed (rows inserted/deleted/updated) I
want to write the DataSet back to the database.
My DataTable shall replace the table in the database.
Consider the original DataAdapter disposed.
My current workaround is to create a new DataAdapter and new DataSet,
fill the new DataSet as I did from the start, replace ALL table rows
with the rows from the first table, and finally call the Update() method
to write back the changes.
This strikes me as not the proper way to do things. I don't see the
point in retrieving all rows from the database if all I want to do is
overwrite the table. Can't I create a new DataAdapter and simply tell it
to update the target table with my DataTable?
Secondly, how do I insert a single row into the target Table? Is the
proper way to write an SQL command and put it in an OleDbCommand object?
Thanks!
- Peder -
I do some stuff, and fill a DataSet from a database.
After the tables have been processed (rows inserted/deleted/updated) I
want to write the DataSet back to the database.
My DataTable shall replace the table in the database.
Consider the original DataAdapter disposed.
My current workaround is to create a new DataAdapter and new DataSet,
fill the new DataSet as I did from the start, replace ALL table rows
with the rows from the first table, and finally call the Update() method
to write back the changes.
This strikes me as not the proper way to do things. I don't see the
point in retrieving all rows from the database if all I want to do is
overwrite the table. Can't I create a new DataAdapter and simply tell it
to update the target table with my DataTable?
Secondly, how do I insert a single row into the target Table? Is the
proper way to write an SQL command and put it in an OleDbCommand object?
Thanks!
- Peder -