DB2®BulkCopy.WriteToServer(System.Data.DataTable) Method
Copies all rows from the DataTable to the destination table specified by the DestinationTableName property.
- Namespace:
IBM.Data.DB2
- Assembly:
IBM.Data.DB2
(inIBM.Data.DB2.dll
)
Syntax
[Visual Basic]
Public Sub WriteToServer ( dataTable As DataTable )
[C#]
public void WriteToServer ( DataTable dataTable )
[C++]
public:
void WriteToServer ( DataTable* dataTable )
[JScript]
public function WriteToServer ( dataTable : DataTable )
Parameters
- dataTable
- A DataTable object whose rows will be copied to the destination table.
Example
[C#] The following example demonstrates a bulk copy of data from a DataTable source into the SALES table.
[C#]
public static void copyIntoSales(DB2Connection conn, DataTable source)
{
DB2BulkCopy salesCopy = new DB2BulkCopy(conn);
salesCopy.DestinationTableName = "SALES";
try
{
salesCopy.WriteToServer(source);
salesCopy.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Exception");
}
}