Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting TableNames from Stored Proc
Message
From
08/03/2004 01:33:06
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00882930
Message ID:
00883984
Views:
6
Victor,

>>I appreciate the feedback - this is unfortunate since i have no control as to whether or not I can guarantee that the stored proc will ever change.

That's unfortunate, but there *is* a way around that problem. After you .Fill() your DataSet, you can test for a specific column name in your tables that are unique to each table, thereby determining if they are being retrieved in the correct order and swap their names if they are not. So, something like this:
for (int i=0; i < ds.Tables.Count; i++)
{
    if (ds.Tables[i].Columns.Contains("CustomerName"))
        ds.Tables[i].TableName = "Customers";
    else if (ds.Tables[i].Columns.Contains("OrderNumber"))
        ds.Tables[i].TableName = "Orders";
}
~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform