OleDbCommand.Parameters Property

 
Namespace:   System.Data.OleDb
Assembly:  System.Data (in System.Data.dll)

member Parameters : OleDbParameterCollection with get

Property Value

Type: System.Data.OleDb.OleDbParameterCollection

The parameters of the SQL statement or stored procedure. The default is an empty collection.

The OLE DB .NET Provider does not support named parameters for passing parameters to an SQL statement or a stored procedure called by an OleDbCommand when CommandType is set to Text. In this case, the question mark (?) placeholder must be used. For example:

SELECT * FROM Customers WHERE CustomerID = ?

Therefore, the order in which OleDbParameter objects are added to the OleDbParameterCollection must directly correspond to the position of the question mark placeholder for the parameter in the command text.

System_CAPS_noteNote

If the parameters in the collection do not match the requirements of the query to be executed, an error may result.

For more information, see Configuring Parameters and Parameter Data Types.

The following example creates an OleDbCommand and displays its parameters. To accomplish this, the method is passed an OleDbConnection, a query string that is an SQL SELECT statement, and an array of OleDbParameter objects.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: