0

我正在尝试针对运行 AS400 的 IBM iSeries 运行存储过程,并在我的标题中出现上述错误。

当我键入以下内容以从 System iNavigator 工具执行存储过程时,它运行良好:

CALL QS36F.HH189P('1','1','')

第一个参数direction在存储过程中定义为输入,第二个为输出,第三个为输出。

问题是当我尝试从设置参数的.Net 代码运行存储过程时。有人可以帮帮我吗?

我的参数列表设置如下:

DB2Command.Parameters.Add("P_STRRRN", iDB2DbType.iDB2Char, 10);
DB2Command.Parameters["P_STRRRN"].Direction = System.Data.ParameterDirection.Input;
DB2Command.Parameters["P_STRRRN"].Value = strRRN;
DB2Command.Parameters.Add("P_LSTRRN", iDB2DbType.iDB2Char, 10);
DB2Command.Parameters["P_LSTRRN"].Value = string.Empty;
DB2Command.Parameters["P_LSTRRN"].Direction = System.Data.ParameterDirection.Output;
DB2Command.Parameters.Add("P_ERRMSG", iDB2DbType.iDB2Char, 70);
DB2Command.Parameters["P_ERRMSG"].Value = string.Empty;
DB2Command.Parameters["P_ERRMSG"].Direction = System.Data.ParameterDirection.Output;

解析度

必须声明命令文本如下:

string cmdtextstring = "CALL QS36F.HH189P" + "('" + strRRN + "',?,?)";

必须设置参数如下:

DB2Command.Parameters.Add("P_LSTRRN", iDB2DbType.iDB2Char, 10);
DB2Command.Parameters["P_LSTRRN"].Value = string.Empty;
DB2Command.Parameters["P_LSTRRN"].Direction = System.Data.ParameterDirection.Output;
DB2Command.Parameters.Add("P_ERRMSG", iDB2DbType.iDB2Char, 70);
DB2Command.Parameters["P_ERRMSG"].Value = string.Empty;
4

1 回答 1

1

如果您将参数作为字符串常量传递,那么 OUT 或 INOUT 值将返回到哪里?DB2 期望您以一种可以将值返回到变量中的方式调用该过程。

于 2014-03-24T19:49:37.330 回答