Solved

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

Posted on 2004-04-28
5
631 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
  • 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
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 …
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

746 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now