ADO CreateParameter 方法
定義和用法
CreateParameter 方法可創(chuàng)建和返回一個(gè) Parameter 對(duì)象,該對(duì)象包含指定的屬性,比如名稱、類型、方向、大小和值。
注釋:此方法不會(huì)將 Parameter 對(duì)象自動(dòng)追加到 Command 對(duì)象的 Parameters 集合。如需向 Parameters 集合添加 Parameter 對(duì)象,請(qǐng)使用 Append 屬性。
語(yǔ)法
Set objparameter=objcommand.CreateParameter (name,type,direction,size,value)
參數(shù) | 描述 |
---|---|
name | 可選。Parameter 對(duì)象的名稱。 |
type | 可選。DataTypeEnum 常量之一,指定 Parameter 對(duì)象的數(shù)據(jù)類型。默認(rèn)是 adEmpty。如果你選擇可變長(zhǎng)度的數(shù)據(jù)類型,則需要規(guī)定 Size 參數(shù)或 Size 屬性。如果規(guī)定 adDecimal 或者 adNumeric 數(shù)據(jù)類型,則必須設(shè)置 Parameter 對(duì)象的NumericScale 和 Precision 屬性。 |
direction | 可選。ParameterDirectionEnum 常量之一,定義 Parameter 對(duì)象的方向。默認(rèn)是 adParamInput。 |
size | 可選。規(guī)定可變數(shù)據(jù)類型的長(zhǎng)度,假如此類類型被聲明于 Type 參數(shù)中。默認(rèn)是 0。 |
value | 可選。Parameter 對(duì)象的值。 |