Set DataTable name in returned data set

15 pts.
Tags:
C# .NET
iSeries SQL
SQL stored procedures
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

Answer Wiki

Thanks. We'll let you know when a new response is added.

You can alias the table names. Do you have an example I can see? thank you.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • LordPerrin
    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
    15 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following