Export (0) Print
Expand All

SqlBulkCopy.WriteToServerAsync Method (DataTable)

.NET Framework 4.5

The asynchronous version of WriteToServer, which copies all rows in the supplied DataTable to a destination table specified by the DestinationTableName property of the SqlBulkCopy object.

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

member WriteToServerAsync : 
        table:DataTable -> Task

Parameters

table
Type: System.Data.DataTable

A DataTable whose rows will be copied to the destination table.

Return Value

Type: System.Threading.Tasks.Task
A task representing the asynchronous operation.

ExceptionCondition
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.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft