ADO » Parameter » Size

Syntax:
long = parameterobject.Size
parameterobject.Size = long

Sets or returns a long value that is the maximum size in bytes or characters of a Parameter object.

The Size property sets or returns a long value that allows you to define or determine the maximum size in bytes or characters of a value in a Parameter object. Note that this is the maximum, not the actual, size.
 
If you set a value for a Parameter object to be a variable-length data type, you must specify the Size before appending the object to the Parameters Collection, or an error will be generated. Similarly, if you change the data type of an already appended Parameter object to be a variable-length data type, you must specify the Size before executing the Command object, or an error will be generated.
 
You can use the Refresh method of the Recordset object to have the provider fill in parameter details. Under these circumstances, the provider will set the variable-length data types to be their maximum size and will allocate the necessary memory. Unfortunately, if memory is at a premium, an error may occur when you attempt an execution. Therefore, you may need to check the Size for provider-assigned variable-length data types.

Examples

Code:
Set objParameter = Server.CreateObject("ADODB.Parameter")

objParameter.Type = adInteger
objParameter.Size = 3
objParameter.Direction = adParamInput
objParameter.Value = intCount

objCommand.Parameters.Append objParameter

See Also: