asp.net.ph

DataTable.Copy Method

System.Data Namespace   DataTable Class


Copies both the structure and data for this DataTable.

[ VB ]
Public Function Copy ( ) As DataTable

[ C# ]
public DataTable Copy ( );

[ C++ ]
public: DataTable* Copy ( );

[ JScript ]
public function Copy ( ) : DataTable;

Return Value

A new DataTable with the same structure ( table schemas, relations, and constraints ) and data as this DataTable.

NOTE: If these classes have been subclassed, the copy will also be of the same subclasses.

Example

The following example uses the Copy method to create a copy of the original DataTable.

Private void CopyDataTable ( DataTable myDataTable ) {
   // create an object variable for the copy.
   DataTable copyDataTable;
   copyDataTable = myDataTable.Copy ( );
   // insert code to work with the copy.
}
  C# VB

See Also

DataTable Members   Clone Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph