Link to home
Start Free TrialLog in
Avatar of mitdaniels
mitdaniels

asked on

Dataset filled with two Stored Procedures

I would like to have two Stored Procedures data brought together into a single Dataset, how do I do this? One of the SP requires a Parameter value.

Please provide a typical ASP.NET / ADO.NET / SQL Server example.
Avatar of Dale Burrell
Dale Burrell
Flag of New Zealand image

Tricky... any chance you can change them into table valued functions?
Avatar of Darren
Hi,

If you have the same number of columns in each query then you cold use a UNION statement in SQL


http://www.w3schools.com/sql/sql_union.asp

http://www.techonthenet.com/sql/union.php

There are many references on the web if you do a quick search for SQL Union

Cheers,

Darren
Retrieve the data from tables in 2 queries and then UNION them in stored procedure in SQL Server.

In Visual Studio ,attach the dataset to grid in asp.net using ADO.Net

http://asmaqureshi.blogspot.com/2010/01/fill-dataset-with-storedprocedure.html
Avatar of mitdaniels
mitdaniels

ASKER

Thanks for the input experts.

The one Stored Procedure does JOINS on numerous tables, and the problem lies with not being able to JOIN one table, which only has two columns, while the JOINED SP has many more columns, so a UNION is perhaps unlikely??
Hi,

I think you might have to put up an example of the data so that we can see what we have to work with.

Cheers,

Darren
Unfortunately a good example will take too much time to put together and explain.
Thus far I've heard nothing from the Dataset or ADO.NET gurus, perhaps the solution lies there??
SOLUTION
Avatar of Darren
Darren
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks, that looks like it might work if I can pull certain columns out to make two DataTables that have the same schema, can that be done? What is the step before the DataTable?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Darren,

The step before the DataTable is it getting the Dataset, or is it possible to use an existing Datareader, this might be a silly question, since I am not really sure how these Dataset features all work together, and  what relationship they have with the DataReader in this instance.

For some reason I get the impression that the DataTable can be used independently of any Dataset, but that might not be so.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think those are the missing pieces, will give it a go today, thanks.
I think you've put me on a path to a solution.