|There's no such thing as a database link object. There is connection classes like
SqlConnection, but unless you plan on joining these results yourself, you can only use one in certain objects like a
SqlDataAdapter. There is ways to link databases together in some RDBMS's like SQL Server. You can then use a stored proc or a view to query both databases using a syntax like "database.owner.object". In most cases, leaving this on the server provides faster access and centralized management of the query and the database links. You could then write a view like so:
SELECT A.Name, A.Birthday, B.AccountID
FROM Table1 A JOIN db2.dbo.Table2 B ON A.ID = B.IDwhere db2 is a linked database.
You can find more information about this in the documentation for your RDBMS like SQL Server. I also suggest you move this to the SQL forum if you continue this way.
Otherwise, you'll need two
SqlConnection objects and two pairs of
SqlDataReader objects (note, I'm assuming SQL here because many lower-end RDBMS's don't support database linking that would use
System.Data.OleDb classes). Then you'll have to read the results and programmatically join these together. This will most likely be much slower and more risky that allowing the database server to do so.
-----BEGIN GEEK CODE BLOCK-----
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----