当前位置:编程学习 > C#/ASP.NET >>

C#调用存储过程,"参数名/列表"错误??????急急急急急急!!!在线等!!!!!!

oracle存储过程:
create or replace procedure P_USERLOGIN(sysuserid  in varchar2,
                                        sysuserpwd in varchar2) as
  icount number; --定义查询到符合记录的条数
begin
  select count(*)
    into icount
    from T_SYS_USERINFO
   where USERID = sysuserid
     and USERPWD = sysuserpwd;
  if icount > 1 then
    icount := 1;
  else
    icount := 0;
  end if;
end P_USERLOGIN;

C#调用P_USERLOGIN过程代码:
 public int GetUserIcount(string UserID,string UserPWD)
        {
            string constring = "Data Source=orcl;Persist Security Info=True;User ID=zkwz;Password=zkwz;Unicode=True";
            OracleConnection con = new OracleConnection(constring);
            OracleCommand cmd = new OracleCommand();
            cmd.Connection = con;
            con.Open();
            cmd.CommandText = "P_USERLOGIN";
            cmd.CommandType = CommandType.StoredProcedure;
            OracleParameter pid=new OracleParameter("@sysuserid", OracleType.VarChar);
            OracleParameter ppwd=new OracleParameter("@sysuserpwd", OracleType.VarChar);
            pid.Value = UserID;
            ppwd.Value = UserPWD;
            cmd.Parameters.Add(pid);
            cmd.Parameters.Add(ppwd);
            //cmd.Parameters["@sysuserid"].Value = UserID;
            //cmd.Parameters["@sysuserpwd"].Value = UserPWD;
            int icount=Convert.ToInt32(cmd.ExecuteScalar());
            con.Close();
            return icount;
        }

为什么总是出错???????????? --------------------编程问答-------------------- 总是提示:
"ORA-01036: 非法的变量名/编号"

为什么?哪里错了?????? --------------------编程问答-------------------- 怎么没人来啊,急用啊!!!
哦,错了,是急学习........ --------------------编程问答-------------------- ????????? --------------------编程问答-------------------- ???????/ --------------------编程问答-------------------- OracleParameter   pid=new   OracleParameter("@sysuserid",   OracleType.VarChar); 
把@去掉,
OracleParameter   pid=new   OracleParameter("sysuserid",   OracleType.VarChar);  --------------------编程问答-------------------- OracleParameter   pid=new   OracleParameter("@sysuserid",   OracleType.VarChar); 
                        OracleParameter   ppwd=new   OracleParameter("@sysuserpwd",   OracleType.VarChar); 
------------

OracleParameter   ppwd=new   OracleParameter("sysuserpwd",   OracleType.VarChar); 

OracleParameter   ppwd=new   OracleParameter("sysuserpwd",  OracleType.VarChar);

正解
补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,