Represents a collection of column mappings from the data source table to the destination table.
System.Object
System.Collections.CollectionBase
IBM.Data.DB2.DB2BulkCopyColumnMappingCollection
[Visual Basic]
NotInheritable Public Class DB2BulkCopyColumnMappingCollection _
Inherits System.Collections.CollectionBase
[C#]
public sealed class DB2BulkCopyColumnMappingCollection :
System.Collections.CollectionBase
[C++]
public ref class DB2BulkCopyColumnMappingCollection sealed :
public System.Collections.CollectionBase
[JScript]
public final class DB2BulkCopyColumnMappingCollection
extends System.Collections.CollectionBase
If no column mappings are defined, columns are mapped based on their ordinal positions in their table schema. If the source and target columns are not compatible, an InvalidOperationException is thrown.
[C#] The following example demonstrates a bulk copy of data from a DB2DataReader into the DEPARTMENT table. The column mappings between the source and target tables are defined by a DB2BulkCopyColumnMappingCollection instance.
[C#]
public static void copyIntoSales(DB2Connection conn, DB2DataReader reader)
{
DB2BulkCopy salesCopy = new DB2BulkCopy(conn);
salesCopy.DestinationTableName = "DEPARTMENT";
DB2BulkCopyColumnMappingCollection colMapCollection;
colMapCollection = new DB2BulkCopyColumnMappingCollection();
salesCopy.ColumnMappings = colMapCollection;
colMapCollection.Add("DEPTNUMB", "DEPTNO");
colMapCollection.Add("DEPTNAME", "DEPTNAME");
colMapCollection.Add("MANAGER", "ADMRDEPT");
colMapCollection.Add("LOCATION", "LOCATION");
try
{
salesCopy.WriteToServer(reader);
salesCopy.Close();
}
catch (DB2Exception ex)
{
MessageBox.Show(ex.ToString(), "Exception");
}
}
Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.