Naming the Tables in the DataSet returned by stored procedure

G

Guest

Greetings

I have a SQL Server stored procedure that performs several queries and therefore creates several "result sets". Wiring it up via ADO.NET I get a DataSet with a number of items in the Tables collection. This is exactly what I want, but I'd like to assign names to these "result sets" in the stored procedure so that I don't have to access these Tables by index number in the code.

Apologies if this is really a SQL Server question.

Thanks
Stuart (gingerbbm)
 
T

tperovic

Check the DataAdapter.TableMappings property.

gingerbbm said:
Greetings

I have a SQL Server stored procedure that performs several queries and
therefore creates several "result sets". Wiring it up via ADO.NET I get a
DataSet with a number of items in the Tables collection. This is exactly
what I want, but I'd like to assign names to these "result sets" in the
stored procedure so that I don't have to access these Tables by index number
in the code.
 
G

Guest

The DataAdapter.TableMappings property will allow me to assign names after the DataSet has been populated.

By default, the "result sets" returned by the stored procedure are named Table1, Table2, etc. What I need to know is whether I can influence these names *within the text of the stored procedure* so that I don't have to use the TableMappings property...

Any ideas?
 
W

William \(Bill\) Vaughn

Nope. The SP is run on the server and has no knowledge of ADO.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

gingerbbm said:
The DataAdapter.TableMappings property will allow me to assign names after
the DataSet has been populated.
By default, the "result sets" returned by the stored procedure are named
Table1, Table2, etc. What I need to know is whether I can influence these
names *within the text of the stored procedure* so that I don't have to use
the TableMappings property...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top