Parameter

This contains all the parameter objects associated with the Command object. Paramters are used to pass arguments to the SQL statements and stored procedures as well as to receive output and return values from stored procedures


Updating the parameters collection


Specify a parameterized command string with the '?' placeholder.
This allows the "?" placeholders to be replaced with parameters when a command is executed
dbADOCommand.CommandText = "SELECT * from authors WHERE au_lname = ?"


Specify a Parameter object. Append it to the Parameters collection.


The parameters collection is associated with a specific command object, which uses the collection to pass parameters in and out of stored procedures and queries.
Parameters can be used to create Parameterized commands. These commands are (after they have been defined and stored) using parameters to alter some details of the command beforeit is executed. For example, an SQL Select statement could use a parameter to define the criteria of a WHERE clause
There are four types of parameters: input parameters, output parameters, input/output parameters and return parameters


When you specify a parameter you must append it to the parameter collection
You must have ADO 2.5+ to be able to return a cursor as an out parameter


Parameter Properties and Methods

NameTypeDescription
HelpContextPropertyReturns the context ID of a topic in the Microsoft Windows help system
HelpFileProperty 
Native ErrorProperty 
NumberPropertyReturns a unique number identifying the error
SourceProperty 
DescriptionProperty 
SQL StatePropertyReturns a 5 character SQL error number
AppendPropertyAdds a new parameter to the Collection

Type
Value
Size
Direction


DirectionadParamInput (default) - represents a parameter into a procedure or function
 adParamInputOutput - represents a parameter both into and out of a procedure or function
 adParamOutput - represents a parameter out of a procedure or function
 adParamReturnValue - represents a return value by a function
 adParamUnknown - represents that the parameter if unknown

ParameterValuePL / SQL TypeVBA TypeDescription
adArray  array 
adBigInt20  8 byte signed integer
adBinary128  a binary value
adBoolean11 booleana boolean value
adByRef    
adBSTR8varchar2 a null terminated character string
adChapter136  4 byte character value for a child recordset
adChar129varcharstringa string value (ensure it is long enough)
adCurrency6 currencycurrency format
adDate7 datea date value, number of days since 12/30/1899
adDBDate133  YYYYMMDD date format
adDBFileTime    
adDBTime    
adDBTimeStamp    
adDecimal*14 decimalnumber with fixed precision and scale
adDouble5 doubledouble precidion floating point
adEmpty0  no value
adError0  32 bit error code
adFileTime64  number of 100-nanosecond intervals since 1/1/1601
adGUID72  global unique identifier
adIDispatch9  currently not supported by ADO
adInteger3natural, numberintegera signed integer (4 bytes)
adIUnknown13  currently not supported by ADO
adLongVarBinary205   
adLongVarChar201   
adLongVarWChar203   
adNumeric*131   
adPropVariant138   
adSingle4 single 
adSmallInt2integerinteger2 byte signed integer
adTinyInt16  1 byte signed integer
adUnsignedBigInt21  8 byte unsigned integer
adUnsignedInt19  4 byte unsigned integer
adUnsignedSmallInt18  2 byte unsigned integer
adUnsignedTinyInt17  1 byte unsigned integer
adUserDefined132  user defined variable
adVarBinary204  binary value
adVarChar200varchar string
adVariant12  automation variant
adVarChar    
adVarNumeric139  variable width exact numeric with signed scale
adVarWChar202  null - terminated Unicode character string
adWChar130  null - terminated Unicode character string

* Note: If you specify either adDecimal or adNumeric you must also specify the NumericScale and Precision properties o fthe Parameter object.


Example - How to pass Null


Example - Creating & Appending a parameter in one step


Example - Stored Procedure - No Parameters

When calling stored procedures you always have to assign a recordset when executing the command


Example - Stored Procedure - 1 Parameter


Example - Stored Function - 1 Parameter


Example - Stored Function - 2 Parameters

The order of the input and the output parameters does not matter.


© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext