asp.net.ph

SqlParameterCollection.RemoveAt Method ( Int32 )

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
);

Parameters

index
The zero-based index of the parameter to remove.

Implements

IList.RemoveAt

Exceptions


Exception Type Condition
IndexOutOfRangeException The specified index does not exist.

Example

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 );

}
  C# VB

See Also

SqlParameterCollection Members   SqlParameterCollection.RemoveAt Overload List 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