473,398 Members | 2,212 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

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 10184
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Jarrod Morrison | last post by:
Hi All Im generally a vb programmer and am used to referencing multiple records returned from a query performed on an sql database and im trying to move some functions of my software into sql...
0
by: sedefo | last post by:
I ran into this Microsoft Patterns & Practices Enterprise Library while i was researching how i can write a database independent data access layer. In my company we already use Data Access...
1
by: M Wells | last post by:
Hi All, Further to my previous long-winded question about a situation in which we appear to be mysteriously losing data from our mssql2k server. We discovered an update statement, in the...
8
by: Thomasb | last post by:
With a background in MS SQL Server programming I'm used to temporary tables. Have just started to work with DB2 ver 7 on z/OS and stumbled into the concept of GLOBAL TEMPORARY TABLE. I have...
2
by: nbohana | last post by:
I am trying to code an compile a stored procedure without success. So I generated one using Microsoft Visule C# .Net. and it follows. One of the problems is that it will not compile. Some of the...
0
by: r1 | last post by:
I am relatively inexperienced in using delegates and asynchronous methods. I read several articles, and then I developed my own code with a mission to improve the performance. Wow! I cannot...
1
by: deepdata | last post by:
Hi, I am trying to fetch data from db2 (express version) database by calling stored procedure. I have tried to use both cursor and for loop but still i am getting error. --======Start...
2
by: rn5a | last post by:
A SQL Server 2005 stored procedure expects a parameter 'UserID' depending upon which it retrieves the no. of records & OrderIDs corresponding to the 'UserID' from a DB table (note that OrderID &...
10
by: pbd22 | last post by:
Hi. Like the title says - how do i do this? I was given the following example: INSERT INTO TABLE2 SELECT * FROM TABLE1 WHERE COL1 = 'A' The above statement threw the following error:
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.