本文介绍了如何在c#中使用有效的表名检索存储过程输出值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
we developed one stored procedure like this
CREATE OR REPLACE PROCEDURE CPCE.SP_GET_SUBJECTIVE_EFILE_DATA
(
IN @RptGrpId INTEGER,
IN @BatchId INTEGER,
IN @UserId VARCHAR,
IN @LogMessage VARCHAR,
OUT @ListCaseReportsCurType CURSOR,
OUT @ListCrDisclosureCurType CURSOR,
OUT @ListCrDisclosureTranDetailAllCurType CURSOR,
OUT @ListCrSarSubPhotoIdAllCurType CURSOR,
OUT @ListRptGrpStaticDataCurType CURSOR,
OUT @ListCountryRptGrpCurType CURSOR,
OUT @ListIdTypeAllCurType CURSOR,
OUT @ListRptGrpCountryAliasCurType CURSOR,
OUT @ListRptGrpStateAliasCurType CURSOR,
OUT @ListRptGrpCityAliasCurType CURSOR,
OUT @ListAgentProfileCurType CURSOR
)
In this stored procedure we are returning the out parameters. In C# code we are calling the stored procedure and retrieving the values like this
DB2Command cmd = new DB2Command("CPCE.SP_GET_SUBJECTIVE_REPORT_DETAILS_FOR_EFILE", connection);
wParam.dsResult = new DataSet();
cmd.CommandTimeout = 0;
cmd.Connection = connection;
cmd.CommandType = CommandType.StoredProcedure;
AddParamsForSp(wParam, cmd);
DB2DataAdapter da = new DB2DataAdapter(cmd);
da.Fill(wParam.dsResult);
Here we are reading all the values to the dsResult dataset, it contains all the datatables we are retrieving the table values like this
dtCaseReports = wParam.dsResult.Tables["Table0"];
dtCrDisclosure = wParam.dsResult.Tables["Table1"];
dtCrDiscTransDetails = wParam.dsResult.Tables["Table2"];
dtSubjectPhotoId = wParam.dsResult.Tables["Table3"];
dtStaticData = wParam.dsResult.Tables["Table4"];
I can able to retrieve all the values but i want to retrieve the values with the valid table names because it is very difficult to remember the Table0,Table1...like this
What we need to change in the stored procedure side for this requirement.
推荐答案
这篇关于如何在c#中使用有效的表名检索存储过程输出值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!