如何使用OleDbCommand从我的C#应用​​程序调用iSeries上的远程过程 [英] How do I call a remote procedure on iSeries from my C# application using OleDbCommand

查看:101
本文介绍了如何使用OleDbCommand从我的C#应用​​程序调用iSeries上的远程过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在iSeries上有一个名为TFARW的远程过程。在iSeries上,我可以通过SQL成功运行此远程过程(例如,CALL BPCSUSR / TFARW('TEST'))。但是,当我尝试从c#应用程序调用这个相同的远程进程时,它只是挂起。我知道iSeries连接字符串是正确的,因为我成功读取了DB2文件。下面是我用来运行远程过程的c#代码:

Hi,
I have a remote procedure called TFARW on an iSeries. On the iSeries I can successfully run this remote procedure via SQL ( eg. CALL BPCSUSR/TFARW ('TEST') ). However when I try to call this same remote procesure from a c# application , it just hangs. I know that the iSeries connection string is correct as I am successfully reading DB2 files. Below is the c# code I am using to run the remote procedure:

SQL="CALL BPCSUSR.TFARW('TEST')
OleDbConnection conn2 = new OleDbConnection(connectionString);
conn2.Close();
conn2.Open();

OleDbCommand cmd = new OleDbCommand(SQL, conn2);
cmd.CommandType = CommandType.StoredProcedure;

cmd.Prepare(); 

cmd.ExecuteNonQuery();
conn2.Close()



在调试中运行时,有什么方法可以确定应用程序的原因挂了吗?上面的代码有什么想法我做错了吗?



问候

Pat


When running in debug, is there any way I can determine why application is hanging ? Any ideas from the code above as to what I am doing wrong ?

regards
Pat

推荐答案

我发现了问题。我的C#代码是正确的但是iSeries存储过程崩溃导致C#应用程序挂起。一旦我修复了存储过程中的问题源,那么打电话。



感谢所有贡献的人



问候

Pat
I have found the problem. My C# code was correct however the iSeries stored procedure was crashing which accounted for the C# application hanging. Once I fixed the source of the problem on the stored procedure then the call worked.

thanks to all who contributed

regards
Pat


这篇关于如何使用OleDbCommand从我的C#应用​​程序调用iSeries上的远程过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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