SqlBulkCopy.ColumnMappings 屬性

定義

傳回 SqlBulkCopyColumnMapping 項目的集合。Returns a collection of SqlBulkCopyColumnMapping items. 資料行對應會定義資料來源中資料行和目的地中資料行之間的關聯性。Column mappings define the relationships between columns in the data source and columns in the destination.

public:
 property System::Data::SqlClient::SqlBulkCopyColumnMappingCollection ^ ColumnMappings { System::Data::SqlClient::SqlBulkCopyColumnMappingCollection ^ get(); };
public System.Data.SqlClient.SqlBulkCopyColumnMappingCollection ColumnMappings { get; }
member this.ColumnMappings : System.Data.SqlClient.SqlBulkCopyColumnMappingCollection
Public ReadOnly Property ColumnMappings As SqlBulkCopyColumnMappingCollection

屬性值

SqlBulkCopyColumnMappingCollection

資料行對應的集合。A collection of column mappings. 根據預設,它可以是空的集合。By default, it is an empty collection.

備註

如果資料來源和目的地資料表具有相同數目的資料行,而且資料來源中每個來源資料行的序數位置符合對應之目的地資料行的序數位置,則不 ColumnMappings 需要此集合。If the data source and the destination table have the same number of columns, and the ordinal position of each source column within the data source matches the ordinal position of the corresponding destination column, the ColumnMappings collection is unnecessary. 但是,如果資料行計數不同,或序數位置不一致,您必須使用 ColumnMappings 來確保資料會複製到正確的資料行。However, if the column counts differ, or the ordinal positions are not consistent, you must use ColumnMappings to make sure that data is copied into the correct columns.

在大量複製作業執行期間,可以存取此集合,但無法變更。During the execution of a bulk copy operation, this collection can be accessed, but it cannot be changed. 任何變更的嘗試都會擲回 InvalidOperationExceptionAny attempt to change it will throw an InvalidOperationException.

適用於

另請參閱