我的存储过程create or replace procedure addstuscore
(
   p_xh in xs.xh%type,
   p_kcm in kc.kcm%type,
   p_cj in xs_kc.cj%type,
   p_xf in xs_kc.xf%type
)
as
   v_kch kc.kch%type;
   v_count number;
begin
   select kc.kch into v_kch from kc where kc.kcm=p_kcm;
   select count(*) into v_count from xs_kc where xs_kc.xh=p_xh and xs_kc.kch=v_kch;  if  v_count=1 then
      update xs_kc set xs_kc.cj=p_cj,xs_kc.xf=p_xf where xs_kc.xh=p_xh and xs_kc.kch=v_kch;
  else
      insert into xs_kc values(p_xh,v_kch,p_cj,p_xf);
  end if;
end; 
/   
  相关的asp中的代码:function OnLoad(){
<%
     OpenConn()
  if Request.Form("StuUpd")="更新" then
         Set SqlCmd=Server.CreateObject("ADODB.COMMAND")   
     SqlCmd.ActiveConnection=SqlConn
 SqlCmd.CommandText="AddStuScore"
 SqlCmd.commandType=4    //调用存储过程
 //创建参数对象
 set StuXH=SqlCmd.CreateParameter("@XH",adVarChar,adParamInput,6)'这行报错!!
 SqlCmd.Parameters.Append(StuXH)
 set StuKCM=SqlCmd.CreateParameter("@KCM",adVarChar,adParamInput,"16")
 SqlCmd.Parameters.Append(StuKCM)
 set StuCJ=SqlCmd.CreateParameter("@CJ",adInteger,adParamInput)
 SqlCmd.Parameters.Append(StuCJ)
 set StuXF=SqlCmd.CreateParameter("@XF",adInteger,adParamInput)
 SqlCmd.Parameters.Append(StuXF)
 //为参数赋值
 SqlCmd("@XH")=Request.Form("StuXH")
 SqlCmd("@KCM")=Request.Form("StuKCM")
 SqlCmd("@CJ")=Cint(Request.Form("StuCJ"))
 SqlCmd("@XF")=Cint(Request.Form("StuXF"))
 SqlCmd.Execute
end if
不知道问题出在那?是不是asp页面调用oralce的存储过程出错呢??

解决方案 »

  1.   

    你首先在sqlplus或toad里面调试存储过程,是否存储过程有什么问题?
    还有你数据类型参数是否正确?
      

  2.   

    ADODB.Command (0x800A0BB9) 
    参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。 
    /xscj/AddStuScore.asp, 第 23 行 网页: 
    POST 103 ??? /xscj/AddStuScore.asp 
    POST Data: 
    StuXH=061101&StuXM=061101&StuKCM=%BC%C6%CB%E3%BB%FA%BB%F9%B4%A1++++++&StuCJ=&StuXF=&StuUpd=%B8%FC%D0%C2 
    这是报错的。