Parameter Object | (Versions 2.0, 2.1, 2.5, 2.6) |
The Parameter object contains information for one variable within a SQL statement or stored procedures. Combined, Parameter objects belong to the Parameters collection of Command objects. |
Parameter.AppendChunk Method | (Versions 2.0, 2.1, 2.5, 2.6) |
parameter.AppendChunk Data | |
The AppendChunk method appends data to a large data or binary field within the current Parameter object. |
|
Arguments | |
|
|
Description | |
The AppendChunk method appends large amounts of either text or binary data to an existing Parameter object. This can be very useful when the current system contains limited system memory in respect to the amount needed for the operation to be performed. With the AppendChunk method, you can add the data to your Field object in increments as you see fit. The adFldLong bit of the Arguments property belonging to the Parameter object must be set in order for the AppendChunk method of the Parameter object to be called. By calling the AppendChunk method multiple times on a Parameter object, you append the data to the pre-existing data in the object. The only way to clear the data in a Parameter object is set it to a zero-length string. By passing a Null value to the AppendChunk method of a Parameter object, you generate an error. |
|
See Also | |
Parameter.Arguments Property |
|
Parameter.Attributes Property | (Versions 2.0, 2.1, 2.5, 2.6) |
parameter.Attributes = ParameterAttributesEnum | |
The Attributes property is used to set or return specific characteristics about the Parameter object. |
|
Datatype | |
ParameterAttributesEnum (Long) |
|
Description | |
The Arguments property is read- and write-enabled. The value of the Arguments property can be set to any sum of the values from the ParameterArgumentsEnum enumeration listed in Appendix E. The default value for the Arguments property is adParamSigned. |
|
See Also | |
ParameterAttributesEnum Enumeration |
|
Parameter.Direction Property | (Versions 2.0, 2.1, 2.5, 2.6) |
parameter.Direction = ParameterDirectionEnum | |
The Direction property specifies whether the current parameter is an input parameter, an output parameter, both an input and an output parameter, or a return value from a stored procedure. |
|
Datatype | |
ParameterDirectionEnum (Long) |
|
Description | |
The Direction property is both read- and write-enabled. It is to your advantage to add parameters manually to a Parameters collection so that ADO does not have to make additional calls to the data provider to locate this information itself. In some cases, you must specify the Direction property manually because the particular data provider may not be able to determine this information itself. The Direction property may be set to one of the ParameterDirectionEnum enumerations listed in Appendix E. |
|
Note | |
Not all providers can determine the value of the Direction property; therefore, for such providers the application must manually set the value of the Direction property for parameters before they are used. |
|
See Also | |
ParameterDirectionEnum Enumeration |
|
Parameter.Name Property | (Versions 2.0, 2.1, 2.5, 2.6) |
parameter.Name = Name | |
The Name property specifies the name for the current Parameter object. |
|
Datatype | |
String |
|
Description | |
The Name property is both read- and write-enabled for the Parameter object. You can set the Name property only if the Parameter object is not already appended to a Parameters collection. The Name property assigns a name to the associated Parameter object or retrieves a Parameter object from the Parameters collection. Names do not have to be unique within the Parameters collection object. |
|
Parameter.NumericScale Property | (Versions 2.0, 2.1, 2.5, 2.6) |
numberscale = parameter.NumericScale | |
The NumericScale property indicates the scale of numeric values in the current Parameter object. |
|
Datatype | |
Byte |
|
Description | |
The NumericScale property is both read- and write-enabled for the Parameter object. It is used to identify how many bytes are used to the right of the decimal point for a numeric Parameter object. |
|
Parameter.Precision Property | (Versions 2.0, 2.1, 2.5, 2.6) |
precision = parameter.Precision | |
The Precision property represents the degree of precision of a numeric value within the current Parameter object. |
|
Datatype | |
Byte |
|
Description | |
The Precision property is both read- and write-enabled for the Parameter object. This property returns a Byte value that indicates the total number of digits used to represent a value for a numeric Parameter object. |
|
Parameter.Properties Collection | (Versions 2.0, 2.1, 2.5, 2.6) |
Set properties = parameter.Properties | |
The Properties collection returns a Properties collection class that contains characteristics specific to the Parameter object for the currently used provider. |
|
Datatype | |
Properties (Collection object) |
|
Description | |
The Properties collection class contains a Property class instance for each property specific to the Parameter object for the data provider. |
|
Parameter.Size Property | (Versions 2.0, 2.1, 2.5, 2.6) |
parameter.Size = size | |
The Size property returns the maximum size of a Parameter object's value. |
|
Datatype | |
Long |
|
Description | |
The Size property returns the maximum size of a parameter's value, in bytes. This property is both read- and write-enabled. If a Parameter object is of variable length datatype, the Size property must be set before it is appended to the Parameters collection, or an error will be generated. If you attempt to change the datatype of a Parameter object to a variable-length datatype, be sure to set the Size property first so that an error will not be generated. You should also set the Size property of the Parameter object before calling the Execute method of the Command object, since if you don't and a variable-length datatype exists, ADO may try to allocate memory based on the maximum amount needed, causing an error. |
|
Parameter.Type Property | (Versions 2.0, 2.1, 2.5, 2.6) |
parameter.Type = DataTypeEnum | |
The Type property identifies the current object's datatype. |
|
Datatype | |
DataTypeEnum (Long) |
|
Description | |
The Type property is both read- and write-enabled for the Parameter object. This property returns a Byte value that indicates the total number of digits used to represent a value for a numeric Parameter object. |
|
See Also | |
DataTypeEnum Enumeration |
|
Parameter.Value Property | (Versions 2.0, 2.1, 2.5, 2.6) |
parameter.Value = value | |
The Value property indicates the value assigned to the current Parameter object. |
|
Datatype | |
Variant |
|
Description | |
The Value property reads and sets the value of the associated Parameter object. The Value property supports long binary data through ADO. ADO reads Parameter objects' Value property only once. If you execute a command containing a parameter with an empty Value property -- and it creates a recordset -- be sure to close the recordset before you read the Value property. |
|
Parameters Collection | |
Set parameters = command.Parameters Set fields = recordset.Fields | |
See the Parameter Object for more information and examples pertaining to the Parameters collection. |
|
Objects | |
|
|
Methods | |
|
|
Properties | |
|
|
Parameters.Append Method | (Versions 2.0, 2.1, 2.5, 2.6) |
parameters.Append Object | |
The Append method appends a new Parameter object to the current Parameters collection class. |
|
Arguments | |
|
|
Description | |
The Append method of the Parameters collection informs ADO of the type of parameters that are included in stored procedures or parameterized queries. You would do this for a couple of reasons: one is that it decreases the time that a stored procedure or parameterized query takes to perform its duty by minimizing the calls to the data provider for this information. Another reason for declaring the parameters in advance -- by adding them to the Parameters collection -- is that not all data providers actually make this information known to ADO. For this reason, unless you populate the Parameters collection yourself, you stand a strong chance of not being able to use these stored procedures or queries at all. It is my advice (as well as Microsoft's) to always declare the parameters of a stored procedure or parameterized query in advance whenever possible, because you may not always be able to rely on the information being available to ADO (and it can't hurt having the extra speed advantage). |
|
See Also | |
Command.CreateParameter Method, Parameter.Size Property, Parameter.Type Property |
|
Parameters.Count Property | (Versions 2.0, 2.1, 2.5, 2.6) |
count = parameters.Count | |
The Count property indicates how many Parameter objects belong to the associated Parameters collection. |
|
Datatype | |
Long |
|
Description | |
If the value of the Count property is zero, there are no Parameter objects within the associated Parameters collection. However, Parameter objects that do belong to the associated Parameters collection are indexed from 0 to one less than the value of the Count property. |
|
Parameters.Delete Method | (Versions 2.0, 2.1, 2.5, 2.6) |
parameters.Delete Index | |
The Delete method removes a Parameter object from the Parameters collection class. |
|
Arguments | |
|
|
Description | |
The Delete method of the Parameters collection class removes a Parameter object from the collection. By passing either the name of a valid Parameter object within the collection or its ordinal position, the Delete method removes the specified Parameter object from the associated Parameters collection class. |
|
See Also | |
Parameter.Name Property |
|
Parameters.Item Property | (Versions 2.0, 2.1, 2.5, 2.6) |
Set error = errors.Item(Index) Set error = errors (Index) | |
The Item property accesses a particular Parameter object belonging to the Parameters collection. |
|
Datatype | |
Object |
|
Description | |
The Index placeholder is a Variant datatype that represents the ordinal position of a Parameter object within the Parameters collection. If the Parameters collection does not contain the item requested, an error is generated. |
|
Note | |
Some languages do not support the Item property in its first syntax. For these languages, use the second syntax, without the Item method name. |
|
Parameters.Refresh Method | (Versions 2.0, 2.1, 2.5, 2.6) |
parameters.Refresh | |
The Refresh method of the Parameters collection class updates the collection with the parameters of the current stored procedure or parameterized query associated with the Command object to which the Parameters collection belongs. |
|
Description | |
The Refresh method updates the Parameters collection class with the parameters of the associated Command object's stored procedure or parameterized query. If you attempt to access the Parameters collection class before calling the Refresh method, it is automatically called by ADO. |
|