SqlDataAdapter.Update()

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I read some records from a text file using OleDbDataAdapter into a DataTable. Now I'd like to upload these records to Sql Server using SqlDataAdapter. Currently, I clone my DataTable and insert records into my cloned DataTable. This way the SqlDataAdapter properly recognizes that the records are new. Does anyone have an alternative technique

Thanks
Paul
 
Hi Paul,

Sure, set oleDbDataAdapter.AcceptChangesDuringFill to false before Filling
data.
The rows will be marked as Added and cloning won't be necessary.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Paul said:
I read some records from a text file using OleDbDataAdapter into a
DataTable. Now I'd like to upload these records to Sql Server using
SqlDataAdapter. Currently, I clone my DataTable and insert records into my
cloned DataTable. This way the SqlDataAdapter properly recognizes that the
records are new. Does anyone have an alternative technique?
 
Back
Top