DataTable.copy method

xiaoxiao2021-03-06  20

.NET Framework class library

DataTable.copy method

Copy the structure and data of the DataTable.

[Visual Basic]

Public function copy () AS DataTable

[C #]

Public DataTable Copy ();

[C ]

PUBLIC: DATATABLE * COPY ();

[Jscript]

PUBLIC FUNCTION COPY (): DataTable;

return value

New DataTable, which has the same structure as the DataTable (table architecture and constraint) and data.

Note If these classes have been derived, the copy also has the same derived class.

Example

[Visual Basic, C #, C ] The following example uses the Copy method to create a copy of the initial DataTable.

[Visual Basic]

Private sub copydataable (byval mydataable as dataable)

'Create An Object Variable for The Copy.

DIM COPYDATABLE AS DATATABLE

CopyDataTable = mydataable.copy ()

'INSERT Code to Work with the copy.

End Sub

[C #]

Private void copydataable (DataTable myDataable) {

// Create An Object Variable for the copy.

DataTable CopyDataTable;

CopyDataTable = mydataable.copy ();

// INSERT CODE to Work with the copy.

}

[C ]

Private:

Void CopyDataTable (DataTable * mydataable) {

// Create An Object Variable for the copy.

DataTable * CopyDataTable;

CopyDataTable = myDataTable-> Copy ();

// INSERT CODE to Work with the copy.

}

[JScript] There is no example available for JScript. To view Visual Basic, C # or C examples, click the "Language Filter" button in the upper left corner.

Claim

Platform: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 Series

See

DataTable Class | DataTable Member | System.Data Namespace | Clone

转载请注明原文地址:https://www.9cbs.com/read-42834.html

New Post(0)