SQL0469 IN,OUT,或INOUT无效的过程参数2 [英] SQL0469 IN, OUT, or INOUT not valid for parameter 2 in procedure

查看:419
本文介绍了SQL0469 IN,OUT,或INOUT无效的过程参数2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对运行于IBM iSeries存储过程运行AS400和得到上述错误在我的称号。

当我输入执行从系统iNavigator工具存储过程的下面,它运行良好:

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

第一个参数方向被存储的过程作为输入,第二输出,以及第三输出作为中定义

问题是,当我尝试从净$ C $的存储过程C设置的参数。有人可以帮我吗?

我的参数列表设置如下:

  DB2Command.Parameters.Add(P_STRRRN,iDB2DbType.iDB2Char,10);
                    。DB2Command.Parameters [P_STRRRN]方向= System.Data.ParameterDirection.Input;
                    。DB2Command.Parameters [P_STRRRN]值= strRRN;
                    DB2Command.Parameters.Add(P_LSTRRN,iDB2DbType.iDB2Char,10);
                    。DB2Command.Parameters [P_LSTRRN] =价值的String.Empty;
                    。DB2Command.Parameters [P_LSTRRN]方向= System.Data.ParameterDirection.Output;
                    DB2Command.Parameters.Add(P_ERRMSG,iDB2DbType.iDB2Char,70);
                    。DB2Command.Parameters [P_ERRMSG] =​​价值的String.Empty;
                    。DB2Command.Parameters [P_ERRMSG]方向= System.Data.ParameterDirection.Output;
 

解决方案

不得不宣布在CommandText如下:

 字符串cmdtextstring =CALL QS36F.HH189P+('+ strRRN +?,?,);
 

只好设置参数如下:

  DB2Command.Parameters.Add(P_LSTRRN,iDB2DbType.iDB2Char,10);
                    。DB2Command.Parameters [P_LSTRRN] =价值的String.Empty;
                    。DB2Command.Parameters [P_LSTRRN]方向= System.Data.ParameterDirection.Output;
                    DB2Command.Parameters.Add(P_ERRMSG,iDB2DbType.iDB2Char,70);
                    。DB2Command.Parameters [P_ERRMSG] =​​价值的String.Empty;
 

解决方案

如果您传递的PARMS为字符串常量,那么在这里就一个OUT或INOUT值返回到? DB2期待你调用程序的方式,它可以返回到值的变量。

I'm trying to run a stored procedure against an IBM iSeries running AS400 and getting the above error in my title.

When I type in the following to execute the stored procedure from the System iNavigator tool, it runs fine:

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

The first parameter direction is defined in the stored procedure as input, the second output, and the third as output.

Problem is when I try to run the stored procedure from .Net code setting up the parameters. Can someone please help me?

My parameter list is set up as follows:

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;

RESOLUTION

Had to declare the commandtext as following:

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

Had to set up the parameters as following:

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;

解决方案

If you are passing the parms as string constants, then where would a OUT or INOUT value be returned to? DB2 is expecting you to call the procedure in a way that it can return values into your variables.

这篇关于SQL0469 IN,OUT,或INOUT无效的过程参数2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆