Bulk insert to sql server

G

Guest

Hi.
We have an object model that return a list of about 2500 lins and i want to
add them to sql as fast as i.

How can I do a bulk insert to sql Using ADO.net?

Thanks
 
E

Elton Wang

Hi Ran,

In ADO.NET 2.0, class SqlBulkCopy can be used to bulk copy
dataset to db. But in ADO.NET 1.1, you should implement
bulk insert yourself.

In my experience, I used StringBuilder to build a large
string and write to a text file, then perform bulk insert
the file content to db. It's much much faster then insert
row by row loop thru datatable.

HTH

Elton Wang
(e-mail address removed)
 

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