SqlBulkCopy.WriteToServerAsync Method (DataTable, DataRowState)
The asynchronous version of WriteToServer, which copies only rows that match the supplied row state in the supplied DataTable to a destination table specified by the DestinationTableName property of the SqlBulkCopy object.
Assembly: System.Data (in System.Data.dll)
Parameters
- table
-
Type:
System.Data.DataTable
A DataTable whose rows will be copied to the destination table.
- rowState
-
Type:
System.Data.DataRowState
A value from the DataRowState enumeration. Only rows matching the row state are copied to the destination.
| Exception | Condition |
|---|---|
| InvalidOperationException | Calling WriteToServerAsync multiple times for the same instance before task completion. Calling WriteToServerAsync and WriteToServer for the same instance before task completion. The connection drops or is closed during WriteToServerAsync execution. Returned in the task object, the SqlBulkCopy object was closed during the method execution. Returned in the task object, there was a connection pool timeout. Returned in the task object, the SqlConnection object is closed before method execution. Context Connection=true is specified in the connection string. |
| SqlException | Returned in the task object, any error returned by SQL Server that occurred while opening the connection. |
For more information about asynchronous programming in the .NET Framework Data Provider for SQL Server, see Asynchronous Programming.
Available since 4.5