473,396 Members | 2,121 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to mix 2 recordsets into one result table?

AFN
Hi. I'm pretty comfortable binding a single recordset result to a
datagrid. But now I have a more unique problem. I have 2 really long
stored procedures that cannot be combined at the SQL Server level (please
don't ask why, but it can't, and even if I could, it would take 10x longer
because they are very involved queries). But I need to mix the recordset
results into one HTML table, and need advice about the best way to do that.
Example:

Table 1
PrimaryID BookName BookPrice
1 Alpha Book $14.00
2 Beta Book $5.00
3 Delta Book $7.00

Table2
ForeignKey BookName BookPrice
1 Animal Book $10.00
2 Mary's Cooking $12.99
2 Mary's Crafts $15.00
3 Fred's Biography $18.00

Desired HTML Table Results after merging the 2 tables, inserting each
matching record from table 2 into table 1, under the record from table 1:

Books For Sale:
Alpha Book $14.00
Animal Book $10.00
Beta Book $5.00
Mary's Cooking $12.99
Mary's Crafts $15.00
Delta Book $7.00
Fred's Biography $18.00
My thoughts? I'm thinking about different ways, and I have no idea what is
fastest, and I also don't want to try them all. For instance, I could get
the 2 recordsets, and then, with code, make my own array, and then bind that
array to a datagrid.

Your suggestions?
Nov 18 '05 #1
5 1363
How about using DataAdapter to fill a DataSet twice, with each Command.
Then bind the Datagrid to the dataset.

--Michael

"AFN" <DE************************@yahoo.com> wrote in message
news:QV***************@twister.socal.rr.com...
Hi. I'm pretty comfortable binding a single recordset result to a
datagrid. But now I have a more unique problem. I have 2 really long
stored procedures that cannot be combined at the SQL Server level (please
don't ask why, but it can't, and even if I could, it would take 10x longer
because they are very involved queries). But I need to mix the recordset
results into one HTML table, and need advice about the best way to do that. Example:

Table 1
PrimaryID BookName BookPrice
1 Alpha Book $14.00
2 Beta Book $5.00
3 Delta Book $7.00

Table2
ForeignKey BookName BookPrice
1 Animal Book $10.00
2 Mary's Cooking $12.99
2 Mary's Crafts $15.00
3 Fred's Biography $18.00

Desired HTML Table Results after merging the 2 tables, inserting each
matching record from table 2 into table 1, under the record from table 1:

Books For Sale:
Alpha Book $14.00
Animal Book $10.00
Beta Book $5.00
Mary's Cooking $12.99
Mary's Crafts $15.00
Delta Book $7.00
Fred's Biography $18.00
My thoughts? I'm thinking about different ways, and I have no idea what is fastest, and I also don't want to try them all. For instance, I could get
the 2 recordsets, and then, with code, make my own array, and then bind that array to a datagrid.

Your suggestions?

Nov 18 '05 #2
AFN
but how would I intersperse the two recordsets into the right order in the
dataset?
"Michael Ramey" <raterus@localhost> wrote in message
news:u3**************@TK2MSFTNGP10.phx.gbl...
How about using DataAdapter to fill a DataSet twice, with each Command.
Then bind the Datagrid to the dataset.

--Michael

"AFN" <DE************************@yahoo.com> wrote in message
news:QV***************@twister.socal.rr.com...
Hi. I'm pretty comfortable binding a single recordset result to a
datagrid. But now I have a more unique problem. I have 2 really long
stored procedures that cannot be combined at the SQL Server level (please don't ask why, but it can't, and even if I could, it would take 10x longer because they are very involved queries). But I need to mix the recordset results into one HTML table, and need advice about the best way to do that.
Example:

Table 1
PrimaryID BookName BookPrice
1 Alpha Book $14.00
2 Beta Book $5.00
3 Delta Book $7.00

Table2
ForeignKey BookName BookPrice
1 Animal Book $10.00
2 Mary's Cooking $12.99
2 Mary's Crafts $15.00
3 Fred's Biography $18.00

Desired HTML Table Results after merging the 2 tables, inserting each
matching record from table 2 into table 1, under the record from table 1:
Books For Sale:
Alpha Book $14.00
Animal Book $10.00
Beta Book $5.00
Mary's Cooking $12.99
Mary's Crafts $15.00
Delta Book $7.00
Fred's Biography $18.00
My thoughts? I'm thinking about different ways, and I have no idea what is
fastest, and I also don't want to try them all. For instance, I could

get the 2 recordsets, and then, with code, make my own array, and then bind

that
array to a datagrid.

Your suggestions?


Nov 18 '05 #3
Sort it?, or create a dataview from the dataset that is sorted the way you
like it.

"AFN" <DE************************@yahoo.com> wrote in message
news:nn***************@twister.socal.rr.com...
but how would I intersperse the two recordsets into the right order in the
dataset?
"Michael Ramey" <raterus@localhost> wrote in message
news:u3**************@TK2MSFTNGP10.phx.gbl...
How about using DataAdapter to fill a DataSet twice, with each Command.
Then bind the Datagrid to the dataset.

--Michael

"AFN" <DE************************@yahoo.com> wrote in message
news:QV***************@twister.socal.rr.com...
Hi. I'm pretty comfortable binding a single recordset result to a
datagrid. But now I have a more unique problem. I have 2 really long stored procedures that cannot be combined at the SQL Server level (please don't ask why, but it can't, and even if I could, it would take 10x longer because they are very involved queries). But I need to mix the recordset results into one HTML table, and need advice about the best way to do

that.
Example:

Table 1
PrimaryID BookName BookPrice
1 Alpha Book $14.00
2 Beta Book $5.00
3 Delta Book $7.00

Table2
ForeignKey BookName BookPrice
1 Animal Book $10.00
2 Mary's Cooking $12.99
2 Mary's Crafts $15.00
3 Fred's Biography $18.00

Desired HTML Table Results after merging the 2 tables, inserting each
matching record from table 2 into table 1, under the record from table 1:
Books For Sale:
Alpha Book $14.00
Animal Book $10.00
Beta Book $5.00
Mary's Cooking $12.99
Mary's Crafts $15.00
Delta Book $7.00
Fred's Biography $18.00
My thoughts? I'm thinking about different ways, and I have no idea what
is
fastest, and I also don't want to try them all. For instance, I could get the 2 recordsets, and then, with code, make my own array, and then

bind that
array to a datagrid.

Your suggestions?



Nov 18 '05 #4
AFN
if you look at my example, there is no way to sort it. the records with the
same IDs from recordset 1 must show before the records from recordset 2 with
those same IDs.
"Michael Ramey" <raterus@localhost> wrote in message
news:u2**************@TK2MSFTNGP11.phx.gbl...
Sort it?, or create a dataview from the dataset that is sorted the way you
like it.

"AFN" <DE************************@yahoo.com> wrote in message
news:nn***************@twister.socal.rr.com...
but how would I intersperse the two recordsets into the right order in the
dataset?
"Michael Ramey" <raterus@localhost> wrote in message
news:u3**************@TK2MSFTNGP10.phx.gbl...
How about using DataAdapter to fill a DataSet twice, with each Command. Then bind the Datagrid to the dataset.

--Michael

"AFN" <DE************************@yahoo.com> wrote in message
news:QV***************@twister.socal.rr.com...
> Hi. I'm pretty comfortable binding a single recordset result to a
> datagrid. But now I have a more unique problem. I have 2 really long > stored procedures that cannot be combined at the SQL Server level

(please
> don't ask why, but it can't, and even if I could, it would take 10x

longer
> because they are very involved queries). But I need to mix the

recordset
> results into one HTML table, and need advice about the best way to do that.
> Example:
>
> Table 1
> PrimaryID BookName BookPrice
> 1 Alpha Book $14.00
> 2 Beta Book $5.00
> 3 Delta Book $7.00
>
> Table2
> ForeignKey BookName BookPrice
> 1 Animal Book $10.00
> 2 Mary's Cooking $12.99
> 2 Mary's Crafts $15.00
> 3 Fred's Biography $18.00
>
> Desired HTML Table Results after merging the 2 tables, inserting each > matching record from table 2 into table 1, under the record from
table 1:
>
> Books For Sale:
> Alpha Book $14.00
> Animal Book $10.00
> Beta Book $5.00
> Mary's Cooking $12.99
> Mary's Crafts $15.00
> Delta Book $7.00
> Fred's Biography $18.00
>
>
> My thoughts? I'm thinking about different ways, and I have no idea

what
is
> fastest, and I also don't want to try them all. For instance, I
could get
> the 2 recordsets, and then, with code, make my own array, and then

bind that
> array to a datagrid.
>
> Your suggestions?
>
>



Nov 18 '05 #5
How about making the sps return an additional column indicating the
source in the order you wanted it...

so for example you could return

ForeignKey BookName BookPrice TableNo.

Then you could sort on Foreignkey, TableNo.

Let me know if that works

AFN wrote:
if you look at my example, there is no way to sort it. the records with the
same IDs from recordset 1 must show before the records from recordset 2 with
those same IDs.
"Michael Ramey" <raterus@localhost> wrote in message
news:u2**************@TK2MSFTNGP11.phx.gbl...
Sort it?, or create a dataview from the dataset that is sorted the way you
like it.

"AFN" <DE************************@yahoo.com> wrote in message
news:nn***************@twister.socal.rr.com...
but how would I intersperse the two recordsets into the right order in
the
dataset?
"Michael Ramey" <raterus@localhost> wrote in message
news:u3**************@TK2MSFTNGP10.phx.gbl...

How about using DataAdapter to fill a DataSet twice, with each
Command.
Then bind the Datagrid to the dataset.

--Michael

"AFN" <DE************************@yahoo.com> wrote in message
news:QV***************@twister.socal.rr.com. ..

>Hi. I'm pretty comfortable binding a single recordset result to a
>datagrid. But now I have a more unique problem. I have 2 really


long
>stored procedures that cannot be combined at the SQL Server level

(please

>don't ask why, but it can't, and even if I could, it would take 10x

longer

>because they are very involved queries). But I need to mix the

recordset

>results into one HTML table, and need advice about the best way to
do
that.

>Example:
>
>Table 1
>PrimaryID BookName BookPrice
>1 Alpha Book $14.00
>2 Beta Book $5.00
>3 Delta Book $7.00
>
>Table2
>ForeignKey BookName BookPrice
>1 Animal Book $10.00
>2 Mary's Cooking $12.99
>2 Mary's Crafts $15.00
>3 Fred's Biography $18.00
>
>Desired HTML Table Results after merging the 2 tables, inserting
each
matching record from table 2 into table 1, under the record from
table
1:

>Books For Sale:
>Alpha Book $14.00
>Animal Book $10.00
>Beta Book $5.00
>Mary's Cooking $12.99
>Mary's Crafts $15.00
>Delta Book $7.00
>Fred's Biography $18.00
>
>
>My thoughts? I'm thinking about different ways, and I have no idea

what

is

>fastest, and I also don't want to try them all. For instance, I
could
get

>the 2 recordsets, and then, with code, make my own array, and then


bind
that

>array to a datagrid.
>
>Your suggestions?
>
>



--
Regards,
Dilip Krishnan
MCAD, MCSD.net
dilipdotnet at apdiya dot com
Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Steve Marciniak | last post by:
I'm trying to display different recordsets (which are 1 field each) as columns right next to one another. For example, Recordset1 is displayed on the left hand side of the screen. Recordset2 is...
1
by: Sascha | last post by:
Hi I need some help on achieving the following: I wrote a querie which collects Data out of three Tables, the Result looks like this: SET NOCOUNT ON DECLARE @ROW INT
2
by: Pieter Linden | last post by:
The answer to this one is probably "test it yourself and find out!", but I'll ask anyway. Pursuant to my previous question - sending separate recordsets to Word using the CreateTableFromRecordset...
16
by: Randy Harris | last post by:
I was inspired by the recent discussion of returning multiple recordsets to ADO from a stored procedure. (Amazed is probably more accurate). I asked about how to accomplish same with Oracle and...
34
by: Jeff | last post by:
For years I have been using VBA extensively for updating data to tables after processing. By this I mean if I had to do some intensive processing that resulted in data in temp tables, I would have...
24
by: Donald Grove | last post by:
I want to populate an array with values from an ado recordset (multiple rows) I use the absolute position of the cursor in the recordset to define the row of my array to be populated. I have a...
12
convexcube
by: convexcube | last post by:
Hi Experts, I have a unbound form which records details of complaints. It also records what products are affected in the complaint. These are stored in a table named ComplaintProducts that has...
3
by: Dooza | last post by:
Hi there, I have a Stored Procedure in SQL 2000 that takes 10 input paremeters, and outputs 11 recordsets, not rows, but 11 different SELECT statements. The purpose of this is to for a menu...
11
by: BeckR | last post by:
Hello - Thanks for reading my post. I am a newbie when it comes to VBA programming, but have managed to do what I need to do, until now. I have an Access 2000 database (running WinXP Pro...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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...
0
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...
0
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...

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.