asp.net.ph

OleDbParameterCollection.Contains Method

System.Data.OleDb Namespace   OleDbParameterCollection Class


Checks whether a parameter is in the collection.

Overload List

1. Checks whether a given OleDbParameter object is in the collection.

2. Checks whether an OleDbParameter with the specified name is in the collection.


Example

The following example shows use of 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 displays the index of the parameter; otherwise, the example displays an error.

NOTE: This example uses one of the overloaded versions of the Contains method. For other examples that may be available, see the individual overload topics.

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 Skip Navigation Links




Previous page Back to top Next page

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

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