Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting TableNames from Stored Proc
Message
 
To
All
General information
Forum:
ASP.NET
Category:
ADO.NET
Title:
Getting TableNames from Stored Proc
Miscellaneous
Thread ID:
00882930
Message ID:
00882930
Views:
55
Here's my Stored Procedure:
CREATE PROCEDURE GetProdsAndCats AS
Select * from Products
Select * from Categories
go

Here's my Console app:
SqlConnection conn = new Connection(...);
SqlDataAdapter da = new SqlDataAdapter("GetProdsAndCats",conn);
da.SelectCommand = new SqlCommand("GetProdsAndCats",conn);
da.SelectCommand.CommanndType = Command.StoredProcedure;

DataSet ds = new DataSet();
da.Fill(ds);
Console.WriteLine(ds.Tables[0].TableName);
Console.WriteLine(ds.Tables[1].TableName);

The problem with this is that I get "Table" and "Table1" respectively for each select statement in my Store Procedure - I'd like to be able to specify my own TableName yet know what statement I'm naming...

In essence, I should be able to do this:
Console.WriteLine(ds.Tables["ProductList"].TableName);
Console.WriteLine(ds.Tables["CategoryList"].TableName);

Is there a consistant manner in which I can do this?
Next
Reply
Map
View

Click here to load this message in the networking platform