asp.net.ph

SqlParameterCollection.Add Method ( Object )

System.Data.SqlClient Namespace   SqlParameterCollection Class


Adds a new SqlParameter object to the parameters collection.

[ VB ]
Overloads Public Sub Add ( _
   ByVal param As Object _
) As Integer

[ C# ]
public int object Add (
   Object param
);

[ C++ ]
public: int Add (
   Object* param
);

[ JScript ]
public function Add (
   param : Object
) : int ;

Parameters

param
The SqlParameter to add.

Return Value

The index of the newly created SqlParameter.

Implements

IList.Add

Exceptions


Exception Type Condition
ArgumentException The parameter passed is not an SqlParameter.

Example

The following example adds a new SqlParameter using this constructor.

public void CreateSqlParamColl ( SqlConnection myConn ) {
   SqlCommand myCmd = new SqlCommand (
      "SELECT * FROM Customers WHERE CustomerID = @CustomerID", myConn );
   SqlParameterCollection myParams = myCmd.Parameters;
   object myParam = new SqlParameter ( "@CustomerID", SqlDbType.VarChar ) );
   int pIndex = myParams.Add ( myParam );
}
  C# VB

See Also

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