|
 |
asp_databases thread: Joining Two Recordsets
Message #1 by "Marcus Lim" <marcus.lim@a...> on Mon, 25 Feb 2002 14:02:28
|
|
Hi,
I have two recordsets from two different data sources. I want to display
the data, sorted, in a single HTML table.
Any ideas the best way to achieve this?
I can't find information on joining or mergig the recordsets. So, if this
is the way to do this, any help would be appreciated.
Many thanx
Marcus
Message #2 by imran.saleem@b... on Mon, 25 Feb 2002 14:09:13 -0000
|
|
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
objConn.Open strConnect
objRS.Open "<table name>", objConn, adOpenForwardOnly, adLockOptimistic,
adCmdTable
while not objRS.EOF
response.write objRS("<field name>")
.
.
.
objRS.MoveNext
wend
objRS.Close
objRS.Open "<table name>", objConn, adOpenForwardOnly, adLockOptimistic,
adCmdTable
response.write "<BR>"
while not objRS.EOF
response.write objRS("<field name>")
.
.
.
objRS.MoveNext
wend
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
-----Original Message-----
From: Marcus Lim [mailto:marcus.lim@a...]
Sent: Monday, February 25, 2002 2:02 PM
To: ASP Databases
Subject: [asp_databases] Joining Two Recordsets
Hi,
I have two recordsets from two different data sources. I want to display
the data, sorted, in a single HTML table.
Any ideas the best way to achieve this?
I can't find information on joining or mergig the recordsets. So, if this
is the way to do this, any help would be appreciated.
Many thanx
Marcus
$subst('Email.Unsub').
Message #3 by Colin.Montgomery@C... on Mon, 25 Feb 2002 14:15:25 -0000
|
|
I imagine you'll have to create a linked table in one of the DBs pointing to
the data in the other DB - at the DB level that is, using an ODBC connection
(or whatever is appropriate for the DB types). E.g. in Access go to tables,
New Table, Linked Table etc.
Then you can run one query JOIN-ing the two (or more) tables and bring all
the data into one recordset.
I'm quite sure there's no way of merging recordsets as this qs has been
asked many times b4, with no answers that i've seen stating how to do it
(please prove me wrong). I suppose you could read RS1 into a
multi-dimensional array, and then read in RS2 and then run a sort on it and
display it that way, but I don't fancy doing it - esp. if you've got loads
of fields and records (think of all them dimensions!) - the Data structure
is going to be very big and resource hungry.
HTH,
Col
-----Original Message-----
From: Marcus Lim [mailto:marcus.lim@a...]
Sent: 25 February 2002 14:02
To: ASP Databases
Subject: [asp_databases] Joining Two Recordsets
Hi,
I have two recordsets from two different data sources. I want to display
the data, sorted, in a single HTML table.
Any ideas the best way to achieve this?
I can't find information on joining or mergig the recordsets. So, if this
is the way to do this, any help would be appreciated.
Many thanx
Marcus
$subst('Email.Unsub').
*******
This message and any attachment are confidential and may be privileged or otherwise protected from disclosure. If you are not the
intended recipient, please telephone or email the sender and delete this message and any attachment from your system. If you are
not the intended recipient you must not copy this message or attachment or disclose the contents to any other person.
For further information about Clifford Chance please see our website at http://www.cliffordchance.com or refer to any Clifford
Chance office.
Message #4 by Atul Jamdade <atul.jamdade@b...> on Mon, 25 Feb 2002 20:19:40 +0530
|
|
Try redesigning your query in such a way that your requirement is achieved
by a single recordset.
-----Original Message-----
From: Marcus Lim [mailto:marcus.lim@a...]
Sent: 25/02/2002 19:32
To: ASP Databases
Subject: [asp_databases] Joining Two Recordsets
Hi,
I have two recordsets from two different data sources. I want to display
the data, sorted, in a single HTML table.
Any ideas the best way to achieve this?
I can't find information on joining or mergig the recordsets. So, if this
is the way to do this, any help would be appreciated.
Many thanx
Marcus
$subst('Email.Unsub').
|
|
 |