SqlBulkCopy Constructor (SqlConnection, SqlBulkCopyOptions, SqlTransaction)

Note: This constructor is new in the .NET Framework version 2.0.

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
)
public SqlBulkCopy (
	SqlConnection connection, 
	SqlBulkCopyOptions copyOptions, 
	SqlTransaction externalTransaction
)
public function SqlBulkCopy (
	connection : SqlConnection, 
	copyOptions : SqlBulkCopyOptions, 
	externalTransaction : SqlTransaction
)

Parameters

connection

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

copyOptions

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

externalTransaction

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 Performing a Bulk Copy Operation in a Transaction.

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

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

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show: