System.Data Namespace DataTable Class
Clears the DataTable of all data.
[ VB ]
Public Sub Clear ( )
[ C# ]
public void Clear ( );
[ C++ ]
public: void Clear ( );
[ JScript ]
public function Clear ( );
All rows in all tables are removed. An exception is generated if the table has any enforced child relations that would cause child rows to be stranded.
The following example clears the table of all data.
Private void ClearTable ( DataTable myTable ) {
try {
myTable.Clear ( );
}
catch ( DataException dataException ) {
Response.Write ( dataException.ToString ( ) );
}
}
Private Sub ClearTable ( myTable As DataTable )
Try
myTable.Clear ( )
Catch dataException As DataException
Response.Write ( dataException.ToString ( ) )
End Try
End Sub |
|
C# |
VB |
DataTable Members