SqlDataAdapter.Update()

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
 
M

Miha Markic [MVP C#]

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top