ADO Size Property

Definition and Usage

The Size property can set or return a long value that indicates the maximum size (in bytes or characters) of the value in the Parameter object.

Syntax

objparameter.Size

Description

If you need to specify the variable-length data type of the Parameter object (for example, all String types, such as adVarChar), the Size property of the object must be set first, and then the object must be appended to the Parameters collection. Otherwise, an error will occur.

If the Parameter object has been appended to the Command object's Parameters collection and its type has been changed to a variable-length data type, the Size property of the Parameter object must be set first, and then the Command object must be executed. Otherwise, an error will occur.

If the Refresh method is used to obtain parameter information from the provider and returns one or more variable-length data type Parameter objects, ADO may allocate memory space for these parameters based on their possible maximum size, which may cause errors during execution. To avoid errors, the Size properties of these parameters should be explicitly set before executing the command.

The Size property is read/write.

Example

<%
set comm=Server.CreateObject("ADODB.Command")
set para=Server.CreateObject("ADODB.Parameter")
para.Type=adVarChar
para.Size=25
para.Direction=adParamInput
para.Value=varfname
comm.Parameters.Append para
%>