你的位置:首页 > ASP.net教程

[ASP.net教程]BulkyCopy .Net

 It has being ages to get back to cnblogs, Career path had been changed back to .Net development in 4 years ago....Things i just leart from my current project I would like to share with you guys is to use sqBulkCopy to save big volume data in a datatable.

  As you might have known, SQL Server provides a function called BCP (Bulky Copy Process), it largely helps us with inserting large amount data into sql tables. Microsoft has created a very similar Ado.net method SqlBulkCopy to perform same way for us, and the performance is pretty good, 18 seconds to save 400,000 rows in the table, Below screen snap illustrate how we can use this functionality in our project framework.

 

 

what we need to do is to tell bulkCopy the physcial table name in DB. bulkCopy.ColumnMapping.Add(count, dc.ColumnName) is Mandatory to call. it is like you should tell bulkCopy how is the columName mapping to the DB table column Name.