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;
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.
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.
}
Private Sub CopyDataTable ( ByVal myDataTable As DataTable )
' create an object variable for the copy.
Dim copyDataTable As DataTable
copyDataTable = myDataTable.Copy ( )
' insert code to work with the copy.
End Sub |
|
C# |
VB |
DataTable Members Clone