Creates a new Parameter object.
The CreateParameter method returns a Parameter object containing the
specified name, type, direction, size, and/or value properties.
Note: The CreateParameter method does not automatically add (append) the new Parameter
to the collection.
If you wish to add a new Parameter to the Parameters Collection, you need to
use the Append property.
You can use CreateParameter without any parameters.
You can later use the various appropriate properties of the Parameter object
to add the name, type, direction, size and/or value.
There are five optional parameters.
If you specify an adDecimal or adNumeric data type, you will also have to
set the NumericScale and the Precision properties of the Parameter object.
DataTypeEnum Constants
Constant | Value | Description |
---|---|---|
adArray | 0x2000 | Combine with another data type to indicate that the other data type is an array |
adBigInt | 20 | 8-byte signed integer |
adBinary | 128 | Binary |
adBoolean | 11 | True or false Boolean |
adBSTR | 8 | Null-terminated character string |
adChapter | 136 | 4-byte chapter value for a child recordset |
adChar | 129 | String |
adCurrency | 6 | Currency format |
adDate | 7 | Number of day since 12/30/1899 |
adDBDate | 133 | YYYYMMDD date format |
adDBFileTime | 137 | Database file time |
adDBTime | 134 | HHMMSS time format |
adDBTimeStamp | 135 | YYYYMMDDHHMMSS date/time format |
adDecimal | 14 | Number with fixed precision and scale |
adDouble | 5 | Double precision floating-point |
adEmpty | 0 | no value |
adError | 10 | 32-bit error code |
adFileTime | 64 | Number of 100-nanosecond intervals since 1/1/1601 |
adGUID | 72 | Globally unique identifier |
adIDispatch | 9 | Currently not supported by ADO |
adInteger | 3 | 4-byte signed integer |
adIUnknown | 13 | Currently not supported by ADO |
adLongVarBinary | 205 | Long binary value |
adLongVarChar | 201 | Long string value |
adLongVarWChar | 203 | Long Null-terminates string value |
adNumeric | 131 | Number with fixed precision and scale |
adPropVariant | 138 | PROPVARIANT automation |
adSingle | 4 | Single-precision floating-point value |
adSmallInt | 2 | 2-byte signed integer |
adTinyInt | 16 | 1-byte signed integer |
adUnsignedBigInt | 21 | 8-byte unsigned integer |
adUnsignedInt | 19 | 4-byte unsigned integer |
adUnsignedSmallInt | 18 | 2-byte unsigned integer |
adUnsignedTinyInt | 17 | 1-byte unsigned integer |
adUserDefined | 132 | User-defined variable |
adVarBinary | 204 | Binary value |
adVarChar | 200 | String |
adVariant | 12 | Automation variant |
adVarNumeric | 139 | Variable width exact numeric with signed scale |
adVarWChar | 202 | Null-terminated Unicode character string |
adWChar | 130 | Null-terminated Unicode character string |
Constant | Value | Description |
---|---|---|
adParamInput | 1 | Input parameter |
adParamInputOutput | 3 | Both input and output parameter |
adParamOutput | 2 | Output parameter |
adParamReturnValue | 4 | Return value |
adParamUnknown | 0 | Direction is unknown |
Set objParameter = objCommand.CreateParameter
objParameter.Name = "ConfirmID"
objParameter.Type = adBoolean
objParameter.Direction = adParamInput
objParameter.Value = True
Set objParameter = objCommand.CreateParameter
("ConfirmID", adBoolean, adParamInput, True)