I have a SQL stored procedure with simple select statements that returns multiple datatables within the dataset. The stored procedure is being called from C#/.NET code.
The stored procedure is returning the data but the datatable names end up Table, Table1, Table2,... when the dataset is received on the .NET side. Is there a way to define the datatable name within the stored procedure that will be used in the dataset and seen on the .NET side?
Software/Hardware used:
iSeries, SQL, C#, .NET
ASKED:
July 15, 2010 3:29 AM
UPDATED:
July 20, 2010 2:21 PM
This is just a couple of the result sets we are returning. What it does is pulls data from mutiple tables and returns them for use in dropdowns on the various pages so it is only done once.
C1 comes across as Table
C2 comes across as Table1
What I need is to define them like this
C1 as AccountType
C2 as AdjustmentCodes
I know they can be renamed once they are in C# code but then I will need to coordinate changes if we add or remove result sets later on.
Thanks for the help.
Create procedure DropDown
( In Library char(10))
Language SQL
Reads SQL Data
Result Sets 31
Specific DropDown
NOT DETERMINISTIC
Begin
Declare SqlStatement VarChar(250);
Declare C1 Cursor with return for S1;
Declare C2 Cursor with return for S2;
– Account Type
Set SqlStatement =
‘Select AYACTT As AccountTypeCode, AYDSAT As AccountTypeDesc’
|| ‘ From ‘ || Trim(Library) || ‘/ACTTYP’
||’ Where AYACTT not in (” ”,”*”)’
|| ‘ Order by AyActT for read only’;
Prepare S1 from SqlStatement;
– Adjustment Codes
Set SqlStatement =
‘Select AJADJ@ As AdjustmentCode, AJDSAJ As AdjustmentDesc ‘
||’ From ‘ || Trim(Library) || ‘/ADJCOD ‘
||’ Order By AJADJ@ for read only’;
Prepare S2 from SqlStatement;
Open C1; Open C2;
return
end