1

这是我的代码片段:

  Set cmd = Server.CreateObject("ADODB.Command")
cmd.ActiveConnection = objCon
       cmd.CommandType = 4
    cmd.CommandText = "SP_USERLOGIN"

       response.Write(p_user_id)
       cmd.Parameters.Append cmd.CreateParameter ("User_locked",adVarChar, adParamInput)
        cmd.parameters(0).value = p_user_id
       cmd.Execute

当我尝试附加参数时,出现以下错误:

参数类型错误、超出可接受范围或相互冲突。

我的存储过程只需要 1 个参数:

create or replace PROCEDURE        SP_USERLOGIN ( User_locked VARCHAR2 ) as
BEGIN
update tusers Set user_account_status='status' where user_id = User_locked;
commit;
END;
4

2 回答 2

2

The problem turned out to be that the constants such as adVarChar, etc. weren't defined. There may have been a second problem with the length of the parameter not defined (that's the 4th argument)

There's a file name ADOVBS.INC that defines these, and if it isn't included then the constant values must be used instead.

To problem went away when this...

cmd.Parameters.Append cmd.CreateParameter ("User_locked",adVarChar, adParamInput)

... was changed to this:

cmd.Parameters.Append cmd.CreateParameter ("User_locked",200, 1, 30)

The 30 above is a length value for the varchar.

于 2013-06-14T19:51:49.760 回答
0

用于替换笨拙的 cmd 对象及其参数处理的微小 (Oracle) 解决方法。假设您要执行 PROC1,一个存储过程并传递两个参数。您创建了一个名为 DUMMY 的虚拟表,其中包含与参数类型对应的两个字段。您插入一行,其中包含任何值。您对 DUMMY 进行更新前触发器。触发器必须执行与 PROC1 完全相同的操作,并将其参数读取为“更新”记录 (:new.a, :new.b) 的字段。在 ASP 中,您使用“update schema.dummy set a=..., b=...”语句,仅此而已。缺点:不正统。优点:更干净的 ASP 代码;易于调试。+ 以相同的方式返回参数,读取虚拟表(顺便说一下,任何表)。

于 2015-02-11T00:24:55.490 回答