T-SQL - How can I name result sets returned by my Stored Procedure??

  • Thread starter Thread starter Crash
  • Start date Start date
C

Crash

SQL Server 2005 SP1 Standard & Express
..NET 2.0 and ADO.NET
C#

Hi,

I have a stored procedure that returns results from 3 select
statements. When I "ExecuteDataset" from C# code the returned dataset
has 3 tables named "Table", "Table1", "Table2"...

Quest: Is there any way that I can use a hint on my select statement or
some other T-SQL option to name the 3 result sets to more descriptive
names like "Customer", "Address", "Product"???
 
I think you name the tables FIRST....

then you try to load them ordinally.

As in... if your first resultset in the stored procedure is Customer(s),
then the first table needs to be Customer.

Check LoadDataSet() also.
 
Hi,

The DataAdapter.Fill method assigns those table names to the result sets. All
results sets are assigned in the order of, "Table", "Table1", "Table2", etc.
You need to map them to tables in your DataSet:

"Setting Up DataTable and DataColumn Mappings"
http://msdn.microsoft.com/library/d...cpconsettingupdatatabledatacolumnmappings.asp

If you're not using a Typed DataSet then you can just rename the tables in
code by setting the TableName property of each DataTable.
 

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

Back
Top