System.Data.OleDb Namespace OleDbParameterCollection Class
Adds an OleDbParameter with the specified name, data type, column width, and source column name to the parameters collection.
[ VB ]
Overloads Public Function Add ( _
ByVal parameterName As String, _
ByVal oleDbType As OleDbType, _
ByVal size As Integer, _
ByVal srcColumn As String, _
) As OleDbParameter
[ C# ]
public OleDbParameter Add (
string parameterName,
OleDbType oleDbType,
int size,
string srcColumn
);
[ C++ ]
public: OleDbParameter* Add (
String* parameterName,
OleDbType oleDbType,
int size,
String* srcColumn
);
[ JScript ]
public function Add (
parameterName : String,
oleDbType : OleDbType,
size : int,
srcColumn : String
) : OleDbParameter;
- parameterName
- The name of the parameter.
- oleDbType
- One of the OleDbType values.
- size
- The width of the column.
- srcColumn
- The name of the source column.
The newly created OleDbParameter.
The following example adds a new OleDbParameter using this constructor.
public void CreateOleDbParamColl ( OleDbConnection myConn ) {
OleDbCommand myCommand = new OleDbCommand (
"SELECT * FROM Customers WHERE CustomerID = ?", myConn );
OleDbParameterCollection myParams = myCommand.Parameters;
OleDbParameter myParam = myParams.Add ( new OleDbParameter (
"CustomerID", OleDbType.VarChar, 5, "CustomerID" ) );
}
Public Sub CreateOleDbParamColl ( myConn As OleDbConnection )
Dim myCommand As New OleDbCommand ( _
"SELECT * FROM Customers WHERE CustomerID = ?", myConn )
Dim myParams As OleDbParameterCollection = myCommand.Parameters
Dim myParam As OleDbParameter = myParams.Add ( New OleDbParameter ( _
"CustomerID", OleDbType.VarChar, 5, "CustomerID" ) )
End Sub |
|
C# |
VB |
OleDbParameterCollection Members OleDbParameterCollection.Add Overload List OleDbType ParameterName Size SourceColumn