System.Data Namespace DataTableCollection Class
Returns the index of the specified DataTable.
Returns the index of a specified DataTable object.
Returns the index of a DataTable with the specified name.
The following example returns the index of a named table in a DataTableCollection.
NOTE: This example uses one of the overloaded versions of IndexOf. For other examples that may be available, see the individual overload topics.
private void GetIndexes ( DataSet ds ) {
DataTableCollection myTables = ds.Tables;
// get the index of the table named "Authors", if it exists.
if ( myTables.Contains ( "Authors" ) ) {
Response.Write ( myTables.IndexOf ( "Authors" ) );
}
}
Private Sub GetIndexes ( ByVal ds As DataSet )
Dim myTables As DataTableCollection = ds.Tables
' get the index of the table named "Authors", if it exists.
If myTables.Contains ( "Authors" ) Then
Response.Write ( myTables.IndexOf ( "Authors" ) )
End If
End Sub |
|
C# |
VB |
DataTableCollection Members