Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What data a store procedure can return
Message
De
07/12/2007 12:47:46
 
 
À
07/12/2007 11:34:23
Sergio Ortiz
Tek Services Group, Llc
Hollywood, Floride, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01273975
Message ID:
01273993
Vues:
13
This message has been marked as the solution to the initial question of the thread.
Sergio,

As Gary mentioned, you can return result sets from an sproc:
SELECT * FROM MyTable 
SELECT * FROM MyOtherTable 
The above will return two result sets from the sproc. Typically you will "capture" this info in a DataSet:
SqlCommand sc = new SqlCommand("MySqlProc", this.oConnection);
sc.CommandType = CommandType.StoredProcedure;

SqlDataAdapter da = new SqlDataAdapter(sc);

// Fill the DataSet
DataSet ds = new DataSet();
da.Fill(ds);
The above will create 2 DataTables in the DataSet, since the sproc returns 2 result sets.

~~Bonnie




>What are the different type of data that a store procedure can return?
>I ussually return a single value, but can I return for example an array or any other type of data?.
>
>
>Thanks
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