我有一个C#应用程序,我试图调用一个ISeries存储过程(包装一个RPGLE程序)。此RPGLE程序将结果集返回给我的C#应用程序。
当我尝试调用存储过程时,它会发生错误并无限期挂起。在调试模式下,我可以看到SQL错误消息,如帖子末尾所示。如果我使用OleDBConnection它可以正常工作,但它不适用于DB2 Connect。
我试图在我的页面上设置跟踪,但它没有帮助,因为页面只是挂起而我无法查看堆栈跟踪。
在ISeries方面,我可以看到程序正确执行(为了测试,我在程序结束时在测试文件中写一条记录。)
之前有其他人遇到过此错误吗?我将不胜感激任何帮助。
谢谢。
码:-
DB2Connection conn1 = new DB2Connection(ConfigurationManager.ConnectionStrings ["db2IBM"].ConnectionString);
conn1.Open();
string callString5 = "PGMLIBLE.GETCONSIGNMENTS";
DB2Command cmd1 = new DB2Command(callString5, conn1);
cmd1.CommandType = CommandType.StoredProcedure;
cmd1.CommandTimeout = 5;
DB2Parameter prmCons = cmd1.Parameters.Add("prmCons", DB2Type.Char, 7);
prmCons.Direction = ParameterDirection.Input;
prmCons.Value = "JUT0016";
DB2Parameter prmCmp = cmd1.Parameters.Add("prmCmp", DB2Type.Char, 3);
prmCmp.Direction = ParameterDirection.Input;
prmCmp.Value = "DTA";
DB2Parameter prmIorE = cmd1.Parameters.Add("prmIorE", DB2Type.Char, 1);
prmIorE.Direction = ParameterDirection.Input;
prmIorE.Value = "Y";
DB2DataAdapter adp = new DB2DataAdapter(cmd1);
DataTable dt = new DataTable();
adp.Fill(dt);
// If I just execute cmd1.executeNonquery it doesn't error.
// cmd1.ExecuteNonQuery();
GridView2.DataSource = dt;
GridView2.DataBind();
conn1.Close();
conn1.Dispose();
cmd1.Dispose();
错误信息:-
ERROR [58005] [IBM][DB2.NET] SQL0902 An unexpected exception has occurred in Process: 5652 Thread 10 AppDomain: Name:aa196883-1-129406018469512609
There are no context policies.
Function: SQLExecDirectADONET (Params)
CallStack: at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at IBM.Data.DB2.DB2ConnPool.HandleUnknownErrors(String strFncMsg, Exception exception, Boolean bThrow)
at IBM.Data.DB2.DB2Command.ExecuteReaderObject(CommandBehavior behavior, String method, DB2CursorType reqCursorType, Boolean abortOnOptValueChg, Boolean skipDeleted, Boolean isResultSet, Int32 maxRows, Boolean skipInitialValidation)
at IBM.Data.DB2.DB2Command.ExecuteReaderObject(CommandBehavior behavior, String method)
at IBM.Data.DB2.DB2Command.ExecuteReader(CommandBehavior behavior)
at IBM.Data.DB2.DB2Command.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
at ShowConsignmentsOpen.Page_Load(Object sender, EventArgs e) in c:InetpubTestStoredProcShowConsignmentsOpen.aspx.cs:line 50
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.showconsignmentsopen_aspx.ProcessRequest(HttpContext context) in c:WINDOWSMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Filesteststoredprocf35f719b99c08192App_Web_yti93vc5.2.cs:line 0
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error)
at System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
at System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
at System.Web.HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr)
at System.Web.HttpRuntime.ProcessRequest(HttpWorkerRequest wr)
at Microsoft.VisualStudio.WebHost.Request.Process()
at Microsoft.VisualStudio.WebHost.Host.ProcessRequest(Connection conn) InnerException Message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Check InnerException property for more detail. SQLSTATE=58005