System.Data Namespace DataTableCollection Class
Returns the DataTable with the specified name.
DataTable variable = DataTableCollection.Item [ name ];
... or ...
DataTable variable = DataTableCollection [ name ];
dim variable as DataTable = DataTableCollection.Item ( name )
... or ...
dim variable as DataTable = DataTableCollection ( name )
variable : DataTable = DataTableCollection.Item ( name );
... or ...
variable : DataTable = DataTableCollection ( name ); |
|
C# |
VB |
JScript |
- name
- The name of the DataTable to find.
A DataTable with the specified name; otherwise a null value if the DataTable does not exist.
Use the Contains method to determine if a table with a specific name exists. If you have the name of a table, but not its index, use the IndexOf method to return the index.
The following example retrieves a single table by name from a DataTableCollection.
private void GetTableByName ( DataSet ds ) {
// get a specific table by name.
DataTable tbl = ds.Tables [ "Suppliers" ];
Response.Write ( tbl.TableName );
}
Private Sub GetTableByName ( ByVal ds As DataSet )
' get a specific table by name.
Dim tbl As DataTable = ds.Tables ( "Suppliers" )
Response.Write ( tbl.TableName )
End Sub |
|
C# |
VB |
DataTableCollection Members DataTableCollection.Item Overload List