asp.net中调用oracle 9i中的存储过程的请教

wyytht wyytht 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区


下面这段代码是我在Oracle 9i的方案下的enshi2004用户下根据向导定义的
(
p_id in number
)
as
begin
declare x number(30);
begin
select count(*) into x from enshi2004.cgfgxx where id = p_id;
if x > 0 then
insert into enshi2004.testclob values (555,'ft','hehe');
else
insert into enshi2004.testclob values (999,'ft','hehe');
end if;
end;
end usp_test;

我在一个测试页面中使用的代码如下:
String strConnect = System.Configuration.ConfigurationSettings.AppSettings["strConnectDB"].ToString(); //这条

语句是从web.config中取得连接字符串

OracleConnection oraConn = new OracleConnection(strConnect);

OracleCommand myCommand = new OracleCommand("enshi2004.usp_test",oraConn);

//其中enshi2004是我的一个用户名,我所使用的表和存储过程都是这个用户的。usp_test是存储过程名。见上。
myCommand.CommandType = CommandType.StoredProcedure;
myCommand.Parameters.Add("@p_id",245);
oraConn.Open();
myCommand.ExecuteNonQuery();

//每次总是这里出错,好像是调用存储过程出现的问题

oraConn.Close();
Response.Write("Success!");

提示错误如下:

ORA-01036: 非法的变量名/编号
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.Data.OracleClient.OracleException: ORA-01036: 非法的变量名/编号

源错误:


行 34: myCommand.Parameters.Add("@p_id",245);
行 35: oraConn.Open();
行 36: myCommand.ExecuteNonQuery();行 37: //每次总是这里出错,

好像是调用存储过程出现的问题
行 38:


源文件: d:\保留\enshi\kjcgxx\testusp.aspx.cs 行: 36


请大虾指教!
谢谢!
...全文
评论 3
收藏 已收藏
分享
返回顶部
wyytht
Oracle 17,133 成员 55,258 内容