Cloning the Schema of the Table
The Clone( )
method creates a new
DataTable
with the same schema as the original,
but it contains none of the data in the original
DataTable
. The following example uses the
Clone( )
method to create a new
DataTable
:
// create a DataTable object variable to receive the clone DataTable cloneDt; cloneDt = dt.Clone();
Get ADO.NET in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.