在 VBScript 中创建参数
CreateParameter in VBScript
我在执行以下代码时遇到错误。下面是代码
oConn.Open strConnectionString, strUserName, strPassword
Set objCommand = CreateObject("ADODB.Command")
'Create and populate the paramaters collection
With objCommand
.ActiveConnection = oConn
.CommandText = "my sp"
.CommandType = 4
.Parameters.Append .CreateParameter("my parameter", adVarChar, adParamInput, 20, "my value")
Set objRecordset = .Execute
End With
添加参数时出错
在纯 VBScript 中,未定义 ad* 常量。证据:
>> Set c = CreateObject("ADODB.Command")
>> c.CreateParameter "my parameter", adVarChar, adParamInput, 20, "my value"
>>
Error Number: 3001
Error Description: Die Argumente sind vom falschen Typ, liegen außerhalb des Gültigkeitsbereiches oder sind miteinander unvereinbar.
>> adVarChar = 200
>> adParamInput = 1
>> c.CreateParameter "my parameter", adVarChar, adParamInput, 20, "my value"
>>
>> (No news are good news)
所以定义它们。
see also
我在执行以下代码时遇到错误。下面是代码
oConn.Open strConnectionString, strUserName, strPassword
Set objCommand = CreateObject("ADODB.Command")
'Create and populate the paramaters collection
With objCommand
.ActiveConnection = oConn
.CommandText = "my sp"
.CommandType = 4
.Parameters.Append .CreateParameter("my parameter", adVarChar, adParamInput, 20, "my value")
Set objRecordset = .Execute
End With
添加参数时出错
在纯 VBScript 中,未定义 ad* 常量。证据:
>> Set c = CreateObject("ADODB.Command")
>> c.CreateParameter "my parameter", adVarChar, adParamInput, 20, "my value"
>>
Error Number: 3001
Error Description: Die Argumente sind vom falschen Typ, liegen außerhalb des Gültigkeitsbereiches oder sind miteinander unvereinbar.
>> adVarChar = 200
>> adParamInput = 1
>> c.CreateParameter "my parameter", adVarChar, adParamInput, 20, "my value"
>>
>> (No news are good news)
所以定义它们。
see also