Export (0) Print
Expand All

DataSet.Clone Method

Copies the structure of the DataSet, including all DataTable schemas, relations, and constraints. Does not copy any data.

[Visual Basic]
Public Overridable Function Clone() As DataSet
[C#]
public virtual DataSet Clone();
[C++]
public: virtual DataSet* Clone();
[JScript]
public function Clone() : DataSet;

Return Value

A new DataSet with the same schema as the current DataSet, but none of the data.

Remarks

Note   If these classes have been subclassed, the clone will also be of the same subclasses.

Example

[Visual Basic, C#, C++] The following example creates a clone of a DataSet object's schema.

[Visual Basic] 
Private Sub GetClone(ByVal myDataSet As DataSet)
   ' Get a clone of the original DataSet.
   Dim cloneSet As DataSet
   cloneSet = myDataSet.Clone()
   ' Insert code to work with clone of the DataSet.
End Sub

[C#] 
private void GetClone(DataSet myDataSet){
   // Get a clone of the original DataSet.
   DataSet cloneSet;
   cloneSet = myDataSet.Clone();
   // Insert code to work with clone of the DataSet.
}

[C++] 
private:
 void GetClone(DataSet* myDataSet){
    // Get a clone of the original DataSet.
    DataSet* cloneSet;
    cloneSet = myDataSet->Clone();
    // Insert code to work with clone of the DataSet.
 }

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

DataSet Class | DataSet Members | System.Data Namespace | Copy

Show:
© 2014 Microsoft