Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting TableNames from Stored Proc
Message
De
08/03/2004 01:33:06
 
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
00882930
Message ID:
00883984
Vues:
7
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform