SqlBulkCopy Constructor (SqlConnection, SqlBulkCopyOptions, SqlTransaction)

SqlBulkCopy Constructor (SqlConnection, SqlBulkCopyOptions, SqlTransaction)

Initializes a new instance of the SqlBulkCopy class using the supplied existing open instance of SqlConnection. The SqlBulkCopy instance behaves according to options supplied in the copyOptions parameter. If a non-null SqlTransaction is supplied, the copy operations will be performed within that transaction.

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

public SqlBulkCopy(
	SqlConnection connection,
	SqlBulkCopyOptions copyOptions,
	SqlTransaction externalTransaction
)

Parameters

connection
Type: System.Data.SqlClient.SqlConnection

The already open SqlConnection instance that will be used to perform the bulk copy.

copyOptions
Type: System.Data.SqlClient.SqlBulkCopyOptions

A combination of values from the SqlBulkCopyOptions enumeration that determines which data source rows are copied to the destination table.

externalTransaction
Type: System.Data.SqlClient.SqlTransaction

An existing SqlTransaction instance under which the bulk copy will occur.

If options include UseInternalTransaction and the externalTransaction argument is not null, an InvalidArgumentException is thrown.

For examples demonstrating how to use SqlBulkCopy in a transaction, see Transaction and Bulk Copy Operations (ADO.NET).

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

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

.NET Framework

Supported in: 3.5, 3.0, 2.0

Community Additions

ADD
Show:
© 2016 Microsoft