asp.net.ph

SqlParameterCollection.Remove Method

System.Data.SqlClient Namespace   SqlParameterCollection Class


Removes the specified SqlParameter from the collection.

[ VB ]
Public Sub Remove ( _
   ByVal parameter As Object _
)

[ C# ]
void Remove (
   object parameter
);

[ C++ ]
public: void Remove (
   Object* parameter
);

[ JScript ]
public function Remove (
   parameter : Object
);

Parameters

parameter
The SqlParameter object to remove from the collection.

Implements

IList.Remove

Exceptions


Exception Type Condition
InvalidCastException The parameter is not an SqlParameter.
SystemException The parameter does not exist in the collection.

Example

The following example first uses the Contains property to find an SqlParameter with a given Value within the Parameters collection of a specifed SqlCommand object. If the parameter exists, the example removes it.

public void SearchSqlParams ( SqlCommand myCmd ) {
   SqlParameterCollection myParams = myCmd.Parameters;
   if ( myParams.Contains ( ( Object ) myParam ) )
      myCmd.Parameters.Remove ( ( Object ) myParam );

}
  C# VB

See Also

SqlParameterCollection Members 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