G
Guest
I am a .NET newbie and I'm surprised to find almost no posts on this question; only a couple that weren't answered. I hope some kind soul answers this post
I have a DataTable whose rows are in various RowStates. I want to copy the entire DataTable to a table in an external MS Access database accessed via an OleDbDataAdapter.
Using the DataAdapter.Update method doesn't work unless all the rows are in the Added state, which isn't the case. Since the RowState property is read-only, I can't assign this myself
I thought using ExecuteNonQuery to do an INSERT of each DataTable row. But since MS Access doesn't support multiple SQL statements in ExecuteNonQuery, I would need to code up a loop doing one ExecuteNonQuery per row. I am concerned this will be too inefficient
I am currently solving this problem by using the DataTable.Clone method to make a copy of the DataTable's structure, and then using LoadDataRow in a loop to add each row to the table copy. I then pass the copy to DataAdapter.Update
All of these approaches seem like a kludge to me. Is there a better way
Thanks for the help
Dave
I have a DataTable whose rows are in various RowStates. I want to copy the entire DataTable to a table in an external MS Access database accessed via an OleDbDataAdapter.
Using the DataAdapter.Update method doesn't work unless all the rows are in the Added state, which isn't the case. Since the RowState property is read-only, I can't assign this myself
I thought using ExecuteNonQuery to do an INSERT of each DataTable row. But since MS Access doesn't support multiple SQL statements in ExecuteNonQuery, I would need to code up a loop doing one ExecuteNonQuery per row. I am concerned this will be too inefficient
I am currently solving this problem by using the DataTable.Clone method to make a copy of the DataTable's structure, and then using LoadDataRow in a loop to add each row to the table copy. I then pass the copy to DataAdapter.Update
All of these approaches seem like a kludge to me. Is there a better way
Thanks for the help
Dave