System.Data.SqlClient.SqlBulkCopy.WriteToServer Method

Copies only rows that match the supplied row state in the supplied System.Data.DataTable to a destination table specified by the SqlBulkCopy.DestinationTableName property of the System.Data.SqlClient.SqlBulkCopy object.

Syntax

public void WriteToServer (System.Data.DataTable table, System.Data.DataRowState rowState)

Parameters

table
A System.Data.DataTable whose rows will be copied to the destination table.
rowState
A value from the System.Data.DataRowState enumeration. Only rows matching the row state are copied to the destination.

Remarks

Only rows in the System.Data.DataTable that are in the states indicated in the rowState argument and have not been deleted are copied to the destination table.

Note:

If System.Data.DataRowState.Deleted is specified, any System.Data.DataRowState.Unchanged, System.Data.DataRowState.Added, and System.Data.DataRowState.Modified rows will also be copied to the server. No exception will be raised.

While the bulk copy operation is in progress, the associated destination System.Data.SqlClient.SqlConnection is busy serving it, and no other operations can be performed on the connection.

The SqlBulkCopy.ColumnMappings collection maps from the System.Data.DataTable columns to the destination database table.

Requirements

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