首页 新闻 会员 周边 捐助

使用动软 DbHelperOra.RunProcedure(string storedProcName, IDataParameter[] parameters, string tableName) 出错

0
悬赏园豆:50 [待解决问题]

ORA-06550: 第 1 行, 第 7 列:
PLS-00306: 调用 'P_REFER' 时参数个数或类型错误
ORA-06550: 第 1 行, 第 7 列:
PL/SQL: Statement ignored

 

但是前后台的参数都已经对应上了,请高手帮忙看看:

 

存储过程是定义了三个输入参数,一个游标输出参数:
1 create or replace package body PKG_DA0100C is
2
3  PROCEDURE P_REFER(
4 P_MATERIAL_CODE IN K_STORAGE_MB.MATERIAL_CODE%TYPE,
5 P_NAME_SX IN K_STORAGE_MB.NAME_SX%TYPE,
6 P_SPECANDTYPE IN K_STORAGE_MB.SPECANDTYPE%TYPE,
7 P_CUR OUT C_CUR
8 )IS
9  BEGIN
10 OPEN P_CUR FOR
11 SELECT * FROM K_STORAGE_MB S
12 WHERE NVL(S.MATERIAL_CODE,'NULL') LIKE P_MATERIAL_CODE||'%'
13 AND NVL(S.NAME_SX,'NULL') LIKE UPPER(P_NAME_SX)||'%'
14 AND NVL(S.SPECANDTYPE,'NULL') LIKE P_SPECANDTYPE||'%'
15 AND S.STOCK_QUANTITY != 0
16 ORDER BY S.MATERIAL_CODE;
17  END P_REFER;
18  end PKG_DA0100C;

前台调用的代码:

1 public void BindData1()
2 {
3
4 OracleParameter[] parameters = {
5 new OracleParameter("MATERIAL_CODE", OracleType.VarChar,12),
6 new OracleParameter("NAME_SX", OracleType.VarChar,150),
7 new OracleParameter("SPECANDTYPE", OracleType.VarChar,1000),
8 new OracleParameter("cursor",OracleType.Cursor),
9 };
10
11
12 parameters[0].Value = Convert.ToString(txt_mat_no.Text);
13 parameters[1].Value = Convert.ToString(txt_pysx.Text);
14 parameters[2].Value = Convert.ToString(txt_specandtype.Text);
15
16 parameters[3].Direction = ParameterDirection.Output;
17
18 DataSet ds = DbHelperOra.RunProcedure("PKG_DA0100C.P_REFER", parameters, "STORGE_INFO");
19 }

RunProcedure函数:

View Code
1 public static DataSet RunProcedure(string storedProcName, IDataParameter[] parameters, string tableName)
2 {
3 using (OracleConnection connection = new OracleConnection(connectionString))
4 {
5 DataSet dataSet = new DataSet();
6 connection.Open();
7 OracleDataAdapter sqlDA = new OracleDataAdapter();
8 //sqlDA.SelectCommand = BuildQueryCommand(connection, storedProcName, parameters );
9  
10 OracleCommand command = new OracleCommand(storedProcName, connection);
11 command.CommandType = CommandType.StoredProcedure;
12
13 foreach (OracleParameter parameter in parameters)
14 {
15 command.Parameters.Add(parameter);
16 }
17 sqlDA.SelectCommand = command;
18 sqlDA.Fill( dataSet, tableName );
19 connection.Close();
20 return dataSet;
21 }
22 }

执行到RunProcedure 18行sqlDA.Fill( dataSet, tableName );的时候出错,报错为参数类型或个数不正确,不知道哪里出错了,请高手指点!
 

紫菀花的主页 紫菀花 | 初学一级 | 园豆:154
提问于:2011-05-11 10:02
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册