asp.net.ph

OleDbParameterCollection.IndexOf Method ( String )

System.Data.OleDb Namespace   OleDbParameterCollection Class


Returns the location of the OleDbParameter with the given name within the collection.

[ VB ]
Overloads Public Function IndexOf ( _
   ByVal parameterName As String _
) As Integer

[ C# ]
public int IndexOf (
   string parameterName
);

[ C++ ]
public: int IndexOf (
   String* parameterName
);

[ JScript ]
public function IndexOf (
   parameterName : String
) : int;

Parameters

parameterName
The name of the parameter to retrieve.

Return Value

The location of the OleDbParameter within the collection.

Implements

IDataParameterCollection.IndexOf

Example

The following example first uses the Contains property to find an OleDbParameter with a given ParameterName within the Parameters collection of a specifed OleDbCommand object. If the parameter exists, the example uses the IndexOf method to display the index of the parameter; otherwise, the example displays an error.

public void SearchOleDbParams ( OleDbCommand myCmd ) {
   OleDbParameterCollection myParams = myCmd.Parameters;
   if ( myParams.Contains ( "Model" ) )
      MessageBox.Show ( "Name: " + myParams [ "Model" ].ToString ( ) + 
         "Index: " + myParams.IndexOf ( "Model" ).ToString ( ) );
   else
      MessageBox.Show ( "Sorry, no such parameter found in the collection" );

}
  C# VB

See Also

OleDbParameterCollection Members   OleDbParameterCollection.IndexOf Overload List 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