i assum that both the tables on db1 and db 2 have a common id.
say you want to get booking info from table 1 and then compare it to the
booking ref in table 2 in db2.
use a stored proc and get the record info. Not a big fan of datareader as
its not disconnected... rather prefer
output parameters if my stored proc returns only one row or a dataset if my
proc returned more than one records..
disconnect the dataset or read the output params into a custom bookingInfo
object
next fire up another query which will take the booking id (from dataset or
custom object you populated from output parameter) and return any
corresponding data from table2 in db2
if you expect more than one value again.. use a dataset or if only one then
user output parameters of stored procs
now you have two objects or two datasets and you just need to iterate them
both to compare corresponding column values
Hope this helps,
--
Regards,
HD
"Mark" <an*******@discussions.microsoft.com> wrote in message
news:D1**********************************@microsof t.com...
by m.r.davies
I have 2 tables on seperate Db's (and servers)
I want to use a datareader on the first table to pick the booking ref, and
then use that booking ref to query the 2nd DB when i have the correct row in the 2nd DB I want to compare each field in
the 2 tables to see if they match
Every time i try and think how i end up with a while loop for the reader
on table1 and a while loop for the reader on table 2
any ideas how i'm going to do this?
Cheers