Solved

How to populate multiple recordsets returned by stored procedure into separate datasets.

Posted on 2004-04-28
5
637 Views
Last Modified: 2010-05-18
I am creating a windows application using visual studio .net. I have a stored procedure that returns 2 recordsets. I want to populate these returned recordsets into two different datasets. for example. if 2 recordsets are returned by my stored procedure, i must be able to populate it into Mydataset1 and Mydataset2.
0
Comment
Question by:binu_star
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 10936912
I don't think this possible without copying the returned table yourself in code and then delete it from the original dataset.

But why should you want 2 separate datasets, instead of 1 dataset with 2 tables
0
 
LVL 21

Accepted Solution

by:
tovvenki earned 250 total points
ID: 10937059
Hi,

Try this if you need to populate it into two different datasets.
      DataSet data1,data2;
      SqlDataAdapter adapter = new SqlDataAdapter("MySp",
                  "SERVER=myserver;DATABASE=northwind;UID=sa;");
            
            
      DataSet data = new DataSet();
      adapter.Fill(data);
      data1 = data.Tables[0].DataSet;
      data2 = data.Tables[1].DataSet;

Why do you need to populate it into two datasets??

I hope that this helps you.
Regards,
Venki
0
 
LVL 1

Author Comment

by:binu_star
ID: 11276976
Hi tovvenki,
   Your solution is working. I still want to know if we can make use of only 2 datasets and directly fill them rather than populating into one and then copying to other datasets.
 Thanks,
 Binu
0
 
LVL 21

Expert Comment

by:tovvenki
ID: 11277012
Hi,
what do you mean by "populating into one and then copying to other datasets.". Do you mean to say that use one dataset populate it use the data and then use the same dataset and repopulate it with the next data set??

regards,
venki
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question