Class Parameter (ADODB VBA)

The class Parameter represents a parameter or argument associated with a Command object based on a parameterized query or stored procedure. To use a Parameter class variable it first needs to be instantiated, for example

AppendChunk

Appends data to a large text or binary data Field, or to a Parameter object.

Use the AppendChunk method on a Field or Parameter object to fill it with long binary or character data. In situations where system memory is limited, you can use the AppendChunk method to manipulate long values in portions rather than in their entirety.

AppendChunk (Val)

Attributes

Indicates one or more characteristics of an object.

Use the Attributes property to set or return characteristics of Connection objects, Parameter objects, Field objects, or Property objects. When you set multiple attributes, you can sum the appropriate constants. If you set the property value to a sum including incompatible constants, an error occurs. Remote Data Service UsageThis property is not available on a client-side Connection object.

Direction

Indicates whether the Parameter represents an input parameter, an output parameter, an input and an output parameter, or if the parameter is the return value from a stored procedure. Possible return values are adParamInput - Indicates that the parameter represents an input parameter, adParamInputOutput - Indicates that the parameter represents both an input and output parameter, adParamOutput - Indicates that the parameter represents an output parameter, adParamReturnValue - Indicates that the parameter represents a return value, adParamUnknown - Indicates that the parameter direction is unknown.

Use the Direction property to specify how a parameter is passed to or from a procedure. The Direction property is read/write; this allows you to work with providers that don't return this information or to set this information when you don't want ADO to make an extra call to the provider to retrieve parameter information. Not all providers can determine the direction of parameters in their stored procedures. In these cases, you must set the Direction property before you execute the query.

Name

Indicates the name of an object.

Use the Name property to assign a name to or retrieve the name of a Command, Property, Field, or Parameter object. The value is read/write on a Command object and read-only on a Property object. For a Field object, Name is normally read-only. However, for new Field objects that have been appended to the Fields collection of a Record, Name is read/write only after the Value property for the Field has been specified and the data provider has successfully added the new Field by calling the Update method of the Fields collection. For Parameter objects not yet appended to the Parameters collection, the Name property is read/write. For appended Parameter objects and all other objects, the Name property is read-only. Names do not have to be unique within a collection. You can retrieve the Name property of an object by an ordinal reference, after which you can refer to the object directly by name. For example, if rstMain.Properties(20).Name yields Updatability , you can subsequently refer to this property as yields Updatability , you can subsequently refer to this property as rstMain.Properties("Updatability") .

NumericScale

Indicates the scale of numeric values in a Parameter or Field object.

Use the NumericScale property to determine how many digits to the right of the decimal point will be used to represent values for a numeric Parameter or Field object. For Parameter objects, the NumericScale property is read/write. For a Field object, NumericScale is normally read-only. However, for new Field objects that have been appended to the Fields collection of a Record, NumericScale is read/write only after the Value property for the Field has been specified and the data provider has successfully added the new Field by calling the Update method of the Fields collection.

Precision

Indicates the degree of precision for numeric values in a Parameter object or for numeric Field objects.

Use the Precision property to determine the maximum number of digits used to represent values for a numeric Parameter or Field object. The value is read/write on a Parameter object. For a Field object, Precision is normally read-only. However, for new Field objects that have been appended to the Fields collection of a Record, Precision is read/write only after the Value property for the Field has been specified and the data provider has successfully added the new Field by calling the Update method of the Fields collection.

Properties

Contains all the Property objects for a specific instance of an object.

Some ADO objects have a Properties collection made up of Property objects. Each Property object corresponds to a characteristic of the ADO object specific to the provider.

Size

Indicates the maximum size, in bytes or characters, of a Parameter object.

Use the Size property to determine the maximum size for values written to or read from the Value property of a Parameter object. If you specify a variable-length data type for a Parameter object (for example, any String type, such as adVarChar), you must set the object's Size property before appending it to the Parameters collection; otherwise, an error occurs. If you have already appended the Parameter object to the Parameters collection of a Command object and you change its type to a variable-length data type, you must set the Parameter object's Size property before executing the Command object; otherwise, an error occurs. If you use the Refresh method to obtain parameter information from the provider and it returns one or more variable-length data type Parameter objects, ADO may allocate memory for the parameters based on their maximum potential size, which could cause an error during execution. To prevent an error, you should explicitly set the Size property for these parameters before executing the command. The Size property is read/write.

Type

Indicates the operational type or data type of a Parameter, Field, or Property object. Here you can find possible values for DataTypeEnum.

For Parameter objects, the Type property is read/write. For new Field objects that have been appended to the Fields collection of a Record, Type is read/write only after the Value property for the Field has been specified and the data provider has successfully added the new Field by calling the Update method of the Fields collection. For all other objects, the Type property is read-only.

Value

Indicates the value assigned to a Field, Parameter, or Property variant.

Use the Value property to set or return data from Field objects, to set or return parameter values with Parameter objects, or to set or return property settings with Property objects. Whether the Value property is read/write or read-only depends upon numerous factors — see the respective object topics for more information. ADO allows setting and returning long binary data with the Value property.