System.Data Namespace DataTable Class
Returns the DataSet that this table belongs to.
Script |
[ DataSet variable = ] DataTable.DataSet |
variable |
Returns the DataSet that this table belongs to. |
The property is read only with no default value.
If a control is data bound to a DataTable, and the table belongs to a DataSet, you can get to the DataSet through this property.
The following example returns the parent DataSet of a given table through the DataSet property.
Private void GetDataSetFromTable ( ) {
DataTable myTable;
// get the DataTabe of a DataGrid.
myTable = ( DataTable ) myDataGrid.DataSource;
// get the DataSet of the DataTable.
DataSet myDataSet = myTable.DataSet;
}
Private Sub GetDataSetFromTable ( )
Dim myTable As DataTable
' get the DataTabe of a DataGrid.
myTable = CType ( myDataGrid.DataSource, DataTable )
' get the DataSet of the DataTable.
Dim myDataSet As DataSet = myTable.DataSet
End Sub |
|
C# |
VB |
DataTable Members DataSet