asp.net.ph

DataTableMappingCollection.IndexOf Method ( DataTableMapping )

System.Data.Common Namespace   DataTableMappingCollection Class


Returns the index of a specified DataTableMapping object.

[ VB ]
NotOverridable Overloads Public Function IndexOf ( _
   ByVal table As Object _
) As Integer Implements IList.IndexOf

[ C# ]
public int IndexOf (
   object table
);

[ C++ ]
public: __sealed int IndexOf (
   Object* table
);

[ JScript ]
public function IndexOf (
   table : Object
) : int;

Parameters

table
The DataTableMapping to find.

Return Value

The index of the DataTableMapping if it is in the collection; otherwise, -1.

Implements

IList.IndexOf

Exceptions


Exception Type Condition
InvalidCastException The parameter passed is not a DataTableMapping object.

Remarks

Use the IndexOf method to determine the index of a given table mapping object.

Before calling IndexOf, you can test for the existence of a table mapping by using the Contains method.

Example

The following example returns the index of each table in a DataTableMappingCollection.

private void GetIndexes ( DataAdapter myAdapter ) {
   DataTableMappingCollection myTables = myAdapter.TableMappings;

   // get the index of each table in the collection.
   foreach ( DataTableMapping myTable in myTables ) {
      Response.Write ( myTables.IndexOf ( myTable ) );
   }
}
  C# VB

See Also

DataTableMappingCollection Members   DataTableMappingCollection.IndexOf Overload List   Contains Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph