Click here to Skip to main content
15,920,632 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.
Posted

1 solution

Hi trinadh,

There is no in build way in C# for doing this. You have to write your own function or logic for doing this. This article explains how you can do this.

http://stackoverflow.com/questions/5699983/datasets-with-actual-tablename[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900