System.Data.SqlClient.SqlBulkCopy.SqlRowsCopied Event

Occurs every time that the number of rows specified by the SqlBulkCopy.NotifyAfter property have been processed.


public event SqlRowsCopiedEventHandler SqlRowsCopied


Note that the settings of SqlBulkCopy.NotifyAfter and SqlBulkCopy.BatchSize are independent. Receipt of a SqlBulkCopy.SqlRowsCopied event does not imply that any rows have been sent to the server or committed.

You cannot call SqlBulkCopy.Close (SqlBulkCopy.Close) or SqlConnection.Close (SqlConnection.Close) from this event. Doing this will cause an InvalidOperationException being thrown, and the System.Data.SqlClient.SqlBulkCopy object state will not change. If the user wants to cancel the operation from the event, the SqlRowsCopiedEventArgs.Abort property of the System.Data.SqlClient.SqlRowsCopiedEventArgs can be used. (See Performing a Bulk Copy Operation in a Transaction for examples that use the SqlRowsCopiedEventArgs.Abort property.)

No action, such as transaction activity, is supported in the connection during the execution of the bulk copy operation, and it is recommended that you not use the same connection used during the SqlBulkCopy.SqlRowsCopied event. However, you can open a different connection.


Namespace: System.Data.SqlClient
Assembly: System.Data (in System.Data.dll)
Assembly Versions: