SqlParameterCollection.Remove Method

Definition

Removes the specified SqlParameter from the collection.

Overloads

Remove(SqlParameter)

Removes the specified SqlParameter from the collection.

Remove(Object)

Removes the specified SqlParameter from the collection.

Remove(SqlParameter)

Removes the specified SqlParameter from the collection.

public:
 void Remove(System::Data::SqlClient::SqlParameter ^ value);
public void Remove (System.Data.SqlClient.SqlParameter value);
override this.Remove : System.Data.SqlClient.SqlParameter -> unit
Public Sub Remove (value As SqlParameter)

Parameters

value
SqlParameter

A SqlParameter object to remove from the collection.

Exceptions

The parameter is not a SqlParameter.

The parameter does not exist in the collection.

Examples

The following example searches for a SqlParameter object in a SqlParameterCollection collection. If the parameter exists, the example removes it. This example assumes that a SqlParameterCollection collection has already been created by a SqlCommand.

public void SearchSqlParams() 
{
    // ...
    // create SqlCommand command and SqlParameter param
    // ...
    if (command.Parameters.Contains(param))
        command.Parameters.Remove(param);
}
Public Sub SearchSqlParams()
    ' ...
    ' create SqlCommand command and SqlParameter param
    ' ...
    If command.Parameters.Contains(param) Then
        command.Parameters.Remove(param)
    End If
End Sub

See also

Remove(Object)

Removes the specified SqlParameter from the collection.

public:
 virtual void Remove(System::Object ^ value);
public void Remove (object value);
abstract member Remove : obj -> unit
override this.Remove : obj -> unit
Public Sub Remove (value As Object)

Parameters

value
Object

The object to remove from the collection.

Implements

See also

Applies to