System.Data.SqlClient Namespace SqlParameterCollection Class
Removes the SqlParameter at the specified index from the collection.
[ VB ]
Overloads Overridable Public Sub RemoveAt ( _
ByVal index As Integer _
)
[ C# ]
public virtual void RemoveAt (
int index
);
[ C++ ]
public: virtual void RemoveAt (
int index
);
[ JScript ]
public function RemoveAt (
index : int
);
- index
- The zero-based index of the parameter to remove.
IList.RemoveAt
The following example first uses the Contains property to find an SqlParameter at the specified index 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 ( myParams [ 3 ] )
myCmd.Parameters.RemoveAt ( 3 );
}
Public Sub SearchSqlParams ( ByVal myCmd As SqlCommand )
Dim myParams As SqlParameterCollection = myCmd.Parameters
If myParams.Contains ( myParams ( 3 ) ) Then
myCmd.Parameters.RemoveAt ( 3 );
End If
End Sub |
|
C# |
VB |
SqlParameterCollection Members SqlParameterCollection.RemoveAt Overload List