create PROCEDURE dbo.sp_InsertSo
(
@cust_name varchar(120)
)
AS
BEGIN
INSERT INTO dbo.so (cust_name)
VALUES (@cust_name)
END
asp:
set cmd=server.CreateObject ("adodb.command")
set cmd.ActiveConnection=conn
cmd.CommandText="{call sp_InsertSo(?)}"
cmd.Parameters.Append cmd.CreateParameter("@cust_name",adInteger,adParamInput)
cmd("@cust_name")="999"
cmd.Execute()
ADODB.Command 错误 '800a0bb9'
参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。
出错行:cmd.Parameters.Append cmd.CreateParameter("@cust_name",adInteger,adParamInput)
用baidu找了半天找不到解决方法,用google搜索英文网站找到:
(a) put <% Option Explicit %> at the top of your code
(b) In case if you have not included, include ADO Type library or ADOVBS.inc at the top of your page.
e.g.
<!-- METADATA TYPE="typelib"
UUID="00000205-0000-0010-8000-00AA006D2EA4"
NAME="ADO 2.5 Type Library"
-->
于是加上:
dim cmd
Dim adCmdSPStoredProc
Dim adParamReturnValue
Dim adParaminput
Dim adParamOutput
Dim adInteger
Dim iVal
Dim oVal
Dim adoField
Dim adVarChar
'这些值在 VB 中是预定义常量,可以直接调用,但在 VBScript 中没有预定义
adCmdSPStoredProc = 4
adParamReturnValue = 4
adParaminput = 1
adParamOutput = 2
adInteger = 3
adVarChar = 200
iVal = 5
oVal = 3
执行成功