System.Data.SqlClient Namespace SqlParameterCollection Class
Adds a specified SqlParameter object to the parameters collection.
[ VB ] Overloads Public Sub Add ( _ ByVal param As SqlParameter _ ) As SqlParameter [ C# ] public SqlParameter Add ( SqlParameter param ); [ C++ ] public: SqlParameter Add ( SqlParameter* param ); [ JScript ] public function Add ( param : SqlParameter ) : SqlParameter;
The newly created SqlParameter.
The following example adds a new SqlParameter using this constructor.
public void CreateSqlParamColl ( SqlConnection myConn ) { SqlCommand myCmd = new SqlCommand ( "SELECT * FROM Customers WHERE CustomerID = ?", myConn ); SqlParameterCollection myParams = myCmd.Parameters; SqlParameter myParam = myParams.Add ( new SqlParameter ( "@CustomerID", SqlDbType.VarChar ) ); }
Public Sub CreateSqlParamColl ( myConn As SqlConnection ) Dim myCmd As New SqlCommand ( _ "SELECT * FROM Customers WHERE CustomerID = ?", myConn ) Dim myParams As SqlParameterCollection = myCmd.Parameters Dim myParam As SqlParameter = myParams.Add ( New SqlParameter ( _ "@CustomerID", SqlDbType.VarChar ) ) End Sub
SqlParameterCollection Members SqlParameterCollection.Add Overload List SqlParameter
© 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