Vault9 Modding Vault9 Graphics Vault9 Code Vault9 Net Vault9 OS Vault9 Gaming Vault9 ChillZone Vault9 Tech Vault9 Archives       Vault9 Global9       Vault9 Fusion     Vault9 Blog     Vault9 Network          
 

Please Note!

This is a read-only board, no new topics or registrations are allowed. The Code Vault has moved to http://forums.vault9.net - Be sure to find more information there!


 
Reply to this topicStart new topic
> ASP News->Using Transactions with SqlBulkCopy
post Nov 10 2009, 05:00 PM
Post #1


Guru
Group Icon

Group: Administration
Posts: 1,224
Joined: 24-July 05
Member No.: 4,918

Sex: Male




The SqlBulkCopy class provides a mechanism for efficiently importing
large amounts of data into a Microsoft SQL Server database. Compared to importing data by executing one INSERT statement for each record to import,
SqlBulkCopy is noticeably faster when importing thousands (or more) records. In a nutshell, importing data using SqlBulkCopy entails creating a
SqlBulkCopy object, specifying the destination database and table, and providing the data to import in the form of a DataTable, DataRow,
or DataReader. In Using SqlBulkCopy To Perform Efficient Bulk SQL Operations we looked at how to use
SqlBulkCopy to programmatically import data from an uploaded Excel spreadsheet into a SQL Server database.



While Using SqlBulkCopy To Perform Efficient Bulk SQL Operations showed how to use the SqlBulkCopy class, it did not explore how SqlBulkCopy
imports fare in the face of an error. What happens if, when importing a total of 10,000 records, an error occurs when importing record number 501? Should those first 500 records
be committed or should the entire batch be rolled back? This article examines the default behavior of the SqlBulkCopy class in the face of an error. It also
looks at how to perform bulk copy operations under the umbrella of a transaction. Read on to learn more!


Note: If you have not yet read Using SqlBulkCopy To Perform Efficient Bulk SQL Operations, please
do so before reading this article...

Read More >



Source: http://www.4guysfromrolla.com/articles/111109-1.aspx
User is offlineProfile CardPM
+Quote PostGo to the top of the page
post Nov 10 2009, 05:00 PM
Post #


Member


Group: Administration

Joined: Today, 08:18 AM





Quote PostGo to the top of the page

Reply to this topicStart new topic



 



- Lo-Fi Version Time is now: 21st March 2010 - 08:18 AM
Privacy Policy
South Africa's Top Sites Kinetiq