Retrieve Data from a stored procedure with multiple select statement

C

claire

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
 
G

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?
 
M

Michael S

gh said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top