ADO CreateParameter 方法

来源:互联网 发布:java实现三个人打球 编辑:程序博客网 时间:2024/05/01 19:50

The CreateParameter method creates and returns a Parameter object containing the specified properties like name, type, direction, size, and value.
CreateParameter的作用是:创建或返回一个新的参数对象,它可以是类似于名称、类型、尺寸大小和值这样的属性。

Note: This method does not automatically add the new Parameter to the collection. To add the Parameter to the Parameters Collection, use the Append property.
注意:这个方法不会将新参数添加到集合中。如果你要实现上述功能,可以使用Append属性。

Syntax
语法

Set objparameter=objcommand.CreateParameter(name,type,direction,size,value)

Parameter
参数 Description
描述 name Optional. The name of the Parameter object.
可选参数。指定参数对象的名称 type Optional. One of the DataTypeEnum contatants that specifies the data type for the Parameter object. Default is adEmpty. If you choose a variable-length data type, you will also need to specify the Size parameter or the Size property. If you specify adDecimal or adNumeric data type, you must also set the NumericScale and the Precision properties of the Parameter object.
 可选参数。可设置为DataTypeEnum常量集内的其中一个常量,以指名参数对象的数据类型。默认值是:adEmpty。如果你选择variable-length[变量-长度]数据类型,你必须还要指定Size参数和Size属性。如果你指定了adDecimal或adNumeric数据类型,你还必须要设置NumericScale[数值尺寸]以及参数对象中的Precision[精密度]属性 direction Optional. One of the ParameterDirectionEnum constants that defines the direction of the Parameter object. Default is adParamInput.
可选参数。可设置为ParameterDirectionEnum常量集内的一个常量,以定义参数对象的direction[方向]。默认值为adParamInput size Optional. Specifies the length of a variable-length data type, if such a type was declared in the Type parameter. Default is zero.
可选参数。指定一个variable-length[变量-长度]数据类型,如果你在Type参数中声明了改类型的话。默认值为0 value Optional. The value of the Parameter object
可选参数。指定参数对象的值

DataTypeEnum Values

Specifies the data type of a Field, Parameter, or Property object
指定一个字段、参数或属性对象的数据类型:

Constant
常量 Value
值 Description
描述 adEmpty 0 No value
空值 adSmallInt 2 A 2-byte signed integer.
一个2位含正负号的整数 adInteger 3 A 4-byte signed integer.
一个4位含正负号的整数 adSingle 4 A single-precision floating-point value.
一个单精度浮点值 adDouble 5 A double-precision floating-point value.
一个双精度浮点值 adCurrency 6 A currency value
一个货币值 adDate 7 The number of days since December 30, 1899 + the fraction of a day.
日期值 adBSTR 8 A null-terminated character string.
一个null-terminated[不含后缀]的字符/字符串 adIDispatch 9 A pointer to an IDispatch interface on a COM object. Note: Currently not supported by ADO.
IDispatch(位于COM对象)界面指示器。
注意:现在还不被ADO支持 adError 10 A 32-bit error code
一个32位的错误代码 adBoolean 11 A boolean value.
一个逻辑值 adVariant 12 An Automation Variant. Note: Currently not supported by ADO.
一个自动操作的变量
注意:现在还不被ADO支持 adIUnknown 13 A pointer to an IUnknown interface on a COM object. Note: Currently not supported by ADO.
IUnknown(位于COM对象)界面指示器。
注意:现在还不被ADO支持 adDecimal 14 An exact numeric value with a fixed precision and scale.
拥有一个固定精确度和范围的一个精确数值 adTinyInt 16 A 1-byte signed integer.
一个1位含正负号的整数 adUnsignedTinyInt 17 A 1-byte unsigned integer.
一个1位不含正负号的整数 adUnsignedSmallInt 18 A 2-byte unsigned integer.
一个2位不含正负号的整数 adUnsignedInt 19 A 4-byte unsigned integer.
一个4位不含正负号的整数 adBigInt 20 An 8-byte signed integer.
一个8位含正负号的整数 adUnsignedBigInt 21 An 8-byte unsigned integer.
一个8位不含正负号的整数 adFileTime 64 The number of 100-nanosecond intervals since January 1,1601
从1601年1月1日开始计算的以100毫微秒为单位所经过的数量(即经过了多少个100毫微秒) adGUID 72 A globally unique identifier (GUID)
全局统一标识符(GUID) adBinary 128 A binary value.
一个二进制值 adChar 129 A string value.
一个字符串值 adWChar 130 A null-terminated Unicode character string.
一个null-terminated(不含后缀)的Unicode[统一的字符编码标准, 采用双字节对字符进行编码]字符/字符串 adNumeric 131 An exact numeric value with a fixed precision and scale.
拥有一个固定精确度和范围的一个精确数值 adUserDefined 132 A user-defined variable.
用户自定义变量 adDBDate 133 A date value (yyyymmdd).
日期值(yyyymmdd) adDBTime 134 A time value (hhmmss).
时间值(hhmmss) adDBTimeStamp 135 A date/time stamp (yyyymmddhhmmss plus a fraction in billionths).
一个日期/时间戳(yyyymmddhhmmss加上一个十一分之一的小数) adChapter 136 A 4-byte chapter value that identifies rows in a child rowset
一个4位的chapter值,它指明了字记录集 adPropVariant 138 An Automation PROPVARIANT.
一个自动操作执行的PROPVARIANT adVarNumeric 139 A numeric value (Parameter object only).
一个数值(仅支持参数[parameter]对象) adVarChar 200 A string value (Parameter object only).
一个字符串值(仅支持参数[parameter]对象) adLongVarChar 201 A long string value.
一个长字符串值 adVarWChar 202 A null-terminated Unicode character string.
一个null-terminated(不含后缀)的Unicode[统一的字符编码标准, 采用双字节对字符进行编码]字符/字符串 adLongVarWChar 203 A long null-terminated Unicode string value.
一个null-terminated(不含后缀)的Unicode[统一的字符编码标准, 采用双字节对字符进行编码] 长字符/字符串 adVarBinary 204 A binary value (Parameter object only).
一个二进制值(仅支持参数[parameter]对象) adLongVarBinary 205 A long binary value.
一个长二进制值(仅支持参数[parameter]对象) AdArray 0x2000 A flag value combined with another data type constant. Indicates an array of that other data type.
一个标记值,它是与其他的数据类型常数结合在一起使用的。它指明了包含其它数据类型的数组

ParameterDirectionEnum Values

Specifies whether the Parameter represents an input parameter, an output parameter, both an input and an output parameter, or the return value from a stored procedure.
指定参数是否代表了一个输入参数、一个输出参数或者同时代表了上述二者,或返回已有的程序值。

Constant
常量 Value
值 Description
描述 adParamUnknown 0 Direction is unknown
未知指示(说明) adParamInput 1 Input parameter
输入参数 adParamOutput 2 Output parameter
输出参数 adParamInputOutput 3 Both input and output parameter
同时包含输入参数和输出参数 adParamReturnValue 4 Return value
返回值
 
原创粉丝点击