Description
SqlBulkCopy is the FASTEST way to insert multiples rows from a data source to a SQL Server/Azure.
using (SqlBulkCopy bulkCopy = new SqlBulkCopy(connection))
{
// SET BatchSize value.
bulkCopy.BatchSize = 50;
bulkCopy.DestinationTableName = "TheDestinationTable";
bulkCopy.WriteToServer(dt);
}
Try it
Options
Properties
Methods
Name |
Description |
WriteToServer |
Copy all rows from the source to the destination table. |
WriteToServerAsync |
The asynchronous version of WriteToServer. Copy all rows from the source to the destination table. |
Events
Name |
Description |
SqlRowsCopied |
Event raised after the number of row in the NotifyAfter has been processed. |