469,591 Members | 1,519 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,591 developers. It's quick & easy.

Retrieve Data from a stored procedure with multiple select statement

gh
I have made the following stored procedure with the following select
statement

select * from user
select * from order, orderdetail where order.id=orderdetail.id

I know I can uses DataReader class to get data from the store procedue.
However, is there any way for me to use DataAdapter to get the data and put
it in separate DataTables in a DataSet?

Nov 16 '05 #1
3 9967
You can make a dataadapter and a data set..

daTest = new dataadapter();

DataSet dsTest = new DataSet(); // or use a typed dataset

daTest.SelectCommand = cmdSelect; //your stored proc

daTest.Fill(dsTest, "tablename"); // your dataset to fill and the table name
in the dataset..

Or leave out the table name to fill all tables ...

Or have separate stored procs and set the select command equal to each one
before filling each table.

I hope this helps.

Cheers

Claire

"gh" <gh******@FSAF.COM> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
I have made the following stored procedure with the following select
statement

select * from user
select * from order, orderdetail where order.id=orderdetail.id

I know I can uses DataReader class to get data from the store procedue.
However, is there any way for me to use DataAdapter to get the data and put it in separate DataTables in a DataSet?

Nov 16 '05 #2

"gh" <gh******@FSAF.COM> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
I have made the following stored procedure with the following select
statement

select * from user
select * from order, orderdetail where order.id=orderdetail.id

I know I can uses DataReader class to get data from the store procedue.
However, is there any way for me to use DataAdapter to get the data and put it in separate DataTables in a DataSet?


A nifty feature:

1. Connect to the sql server from inside visual studio 2003.
2. Create a DataSet in your project
3. Drag and drop the stored procedure to your DataSet.
4. Make each DataTable type global.
5. Great magic occured - Smile!

Now using DataAdapters to read to your DataSet is very easy.

Best Regards
- Michael S
Nov 16 '05 #3
It will do it automatically if the DB supports batch queries. just call
adapter.Fill(dataSetName).

Tables[0] will be the results of the first query, dataSetName.Tables[1] will
be the second, You can then use the table mappings to make things clean and
nice.

HTH,

Bill

--

W.G. Ryan, eMVP

http://forums.devbuzz.com/
http://www.knowdotnet.com/williamryan.html
http://www.msmvps.com/WilliamRyan/
"gh" <gh******@FSAF.COM> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
I have made the following stored procedure with the following select
statement

select * from user
select * from order, orderdetail where order.id=orderdetail.id

I know I can uses DataReader class to get data from the store procedue.
However, is there any way for me to use DataAdapter to get the data and put it in separate DataTables in a DataSet?

Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by Jarrod Morrison | last post: by
8 posts views Thread by Thomasb | last post: by
2 posts views Thread by nbohana | last post: by
2 posts views Thread by rn5a | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.