System.Data.OleDb Namespace OleDbParameterCollection Class
Adds an OleDbParameter to the parameters collection.
1. Adds a new OleDbParameter object to the parameters collection.
2. Adds a specified OleDbParameter object to the parameters collection.
3. Adds an OleDbParameter with the specified name and value to the parameters collection.
4. Adds an OleDbParameter with the specified name and data type to the parameters collection.
5. Adds an OleDbParameter with the specified name, data type, and column width to the parameters collection.
6. Adds an OleDbParameter with the specified name, data type, column width, and source column name to the parameters collection.
The following example adds a new OleDbParameter.
NOTE: This example shows how to use one of the overloaded versions of Add. For other examples that may be available, see the individual overload topics.
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
|
|