Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Handling SP's with multiple result sets
Message
 
À
24/03/2007 18:52:10
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Database:
MS SQL Server
Divers
Thread ID:
01207968
Message ID:
01208436
Vues:
15
Thanks...


>Richard,
>
>Use a DataAdapter instead of TableAdapters:
>
>
>public DataSet GetMyData()
>{
>	// I wouldn't actually hard-code the connection string here, it should be in your config settings
>	string TestConnection = "server=(local);database=MyDataBase;uid=sa;pwd=MyPassword";
>	SqlConnection MyConnection = new SqlConnection(TestConnection);
>
>	SqlCommand sc = new SqlCommand("MyStoredProc", MyConnection);
>	sc.CommandType = CommandType.StoredProcedure;
>	SqlDataAdapter da = new SqlDataAdapter(sc);
>
>	DataSet ds = new DataSet();
>	da.Fill(ds);
>
>	return ds;
>}
>
>
>Now, if the Stored Proc returns more than one table, the DataSet will contain tables with the following names: Table, Table1, Table2, etc.
>
>~~Bonnie
>
>
>>I have a dataset that contains a tableadapter pulling from a Stored Procedure. This SP returns two result sets (currently one is empty). What is the best way of handling this? Or how do I access the second result set?
>>
>>Thanks
>>
>>Richard
State of Florida, DCF
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform