473,851 Members | 2,273 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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=orderd etail.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 10216
You can make a dataadapter and a data set..

daTest = new dataadapter();

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

daTest.SelectCo mmand = cmdSelect; //your stored proc

daTest.Fill(dsT est, "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******** **********@TK2M SFTNGP11.phx.gb l...
I have made the following stored procedure with the following select
statement

select * from user
select * from order, orderdetail where order.id=orderd etail.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******** **********@TK2M SFTNGP11.phx.gb l...
I have made the following stored procedure with the following select
statement

select * from user
select * from order, orderdetail where order.id=orderd etail.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(da taSetName).

Tables[0] will be the results of the first query, dataSetName.Tab les[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******** **********@TK2M SFTNGP11.phx.gb l...
I have made the following stored procedure with the following select
statement

select * from user
select * from order, orderdetail where order.id=orderd etail.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
6024
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 stored procedures. So far ive been able to move the functions relatively easily but im unsure about how to output multiple values from an sql stored procedure. By this i mean for example one of the stored procedures may take your username and return...
0
5420
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 Application Block (DAAB) in our .Net projects. We use SqlHelper in SQL based projects, and OracleHelper in Oracle based ones. OracleHelper was not published officially by Microsoft as part of the DAAB but it was given as a helper code in a sample .Net...
1
2135
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 stored procedure we believe is at fault, after which no error check was being performed. Under certain conditions, this update is fired against the same record in the same table as the immediately preceding update statement within
8
7951
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 created a temporary database with a tables space. Verified that DECLARE GLOBAL TEMPORARY TABLE TEMP (A INTEGER); INSERT INTO SESSION.TEMP VALUES(10); SELECT A FROM SESSION.TEMP; works from a query tool.
2
4719
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 message won't to put ';' all over the place, I some need help!!! These are some of the compile messages. ; expected Cannot use more than one type in a for, using, fixed, or declaration statement = (cannot specify constructor arguments in...
0
1284
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 believe the difference in speed! However, the asynch operation fails sometimes, despite of the fact that it works most of the time. I am really at a loss how to fix this sporadic and erratic behavior. This is a web application developed with...
1
13675
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 procedure============= Create PROCEDURE get_timedout_scripts (
2
3736
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 & UserID are two of the columns in the DB table). So for e.g. consider a user whose UserID=6 & the DB table has 3 records whose UserID=6. In other words, there are 3 OrderID records of the user whose UserID=6, say, OrderID=8, OrderID=17 & OrderID=29....
10
17958
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
9744
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11011
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10670
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10725
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10352
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9503
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7072
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5735
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5931
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.