System.Data.Common Namespace DataTableMappingCollection Class
Returns the index of a DataTableMapping with the specified DataSetTable name.
[ VB ]
NotOverridable Overloads Public Function IndexOf ( _
ByVal dataSetTable As String _
) As Integer
[ C# ]
public int IndexOf (
String dataSetTable
);
[ C++ ]
public: __sealed int IndexOf (
String* dataSetTable
);
[ JScript ]
public function IndexOf (
dataSetTable : String
) : int
- dataSetTable
- The case-insensitive name of a DataSetTable.
The index of the DataTableMapping if it is in the collection; otherwise, -1.
The following example searches for a DataTableMapping object with the given DataSetTable name. If the DataTableMapping exists, it is returned.
public void FindDataTableMapping ( DataAdapter myAdapter ) {
// get table mappings
DataTableMappingCollection myTables = myAdapter.TableMappings;
DataTableMapping mytable;
if ( myTables.IndexOfDataSetTable ( "tblEmployees" ) != -1 ) {
mytable = myTables.GetByDataSetTable ( "tblEmployees" );
}
}
Public Sub FindDataTableMapping ( ByVal myAdapter As DataAdapter )
' get table mappings
Dim myTables As DataTableMappingCollection = myAdapter.TableMappings;
Dim mytable As DataTableMapping;
If ( myTables.IndexOfDataSetTable ( "tblEmployees" ) <> -1 ) {
mytable = myTables.GetByDataSetTable ( "tblEmployees" );
End If
End Sub |
|
C# |
VB |
DataTableMappingCollection Members IndexOf Contains