Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem with SqlConnection 4 159
Windows Service to Receive TCP Packets 4 120
Visual Studio - "Windows Form Designer generated code" 2 39
Server Error 11 47
The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

911 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

16 Experts available now in Live!

Get 1:1 Help Now