ADO CreateParameter 方法

定义和用法

CreateParameter 方法可创建和返回一个 Parameter 对象,该对象包含指定的属性,比如名称、类型、方向、大小和值。

注释:此方法不会将 Parameter 对象自动追加到 Command 对象的 Parameters 集合。如需向 Parameters 集合添加 Parameter 对象,请使用 Append 属性。

语法

Set objparameter=objcommand.CreateParameter
(name, type, direction, size, value)
Parameter Description
name Optional. Name of the Parameter Object.
type Optional.DataTypeEnum A constant that specifies the data type of the Parameter Object. The default is adEmpty. If you choose a variable length data type, you need to specify the Size parameter or Size property. If you specify adDecimal or adNumeric data type, you must set the NumericScale and Precision properties of the Parameter Object.
direction Optional.ParameterDirectionEnum A constant that defines the direction of the Parameter Object. The default is adParamInput.
size Optional. Specify the length of the variable data type, if such a type is declared in Type In the parameter. The default is 0.
value Optional. Value of Parameter Object.