DB2®BulkCopy.Close Method

Closes the DB2BulkCopy instance.

Namespace:
IBM.Data.DB2
Assembly:
IBM.Data.DB2 (in IBM.Data.DB2.dll)

Syntax


[Visual Basic]
Public Sub Close
[C#]
public void Close ()
[C++]
public:
void Close ()
[JScript]
public function Close ()

Remarks

After you call Close on a DB2BulkCopy instance, no other operation will succeed. Any actions involving members of a DB2BulkCopy instance after running Close will result in the data provider throwing an InvalidOperationException.

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");
  }
}