PDA

Click to See Complete Forum and Search --> : ADO...connecting two diff ODBC --databases


raj
Mar 23rd, 2000, 09:50 PM
hi
i was wondering if we could connect two diff. databases and then link them thr. two diff fields from diff. tables and databases....e.g.

datbase1
tableA
fld1 fld2 fld2

database2
table B
fld4 fld5 fld6

so connect thr. 2 diff. recordset....
fld1 to fld5

and then add this output in combo box .... like

combo1.additem rs1!fld1, rs1!fld2, rs2!fld4 , rs2!fld6

JHausmann
Mar 24th, 2000, 12:17 AM
Depends.

SQL server 6.5 on same server - yes
SQL server 6.5 on different servers - no
Sql server 7.0 - appears to be yes
Access (any version) without attached tables - no
Access with attached tables - yes

The two tables will need to have a field in common (name does't have to be but the data type and content need to be).

You'll only need one ADO connection to do it, if you can do it.

lupus
Mar 26th, 2000, 01:06 AM
Great to know. But how
To open two databases in one ADO connection?

And what is attacted table?

lupus


Depends.

SQL server 6.5 on same server - yes
SQL server 6.5 on different servers - no
Sql server 7.0 - appears to be yes
Access (any version) without attached tables - no
Access with attached tables - yes

The two tables will need to have a field in common (name does't have to be but the data type and content need to be).

You'll only need one ADO connection to do it, if you can do it.

Clunietp
Mar 26th, 2000, 01:15 AM
If you have your tables attached (MS ACCESS), your SQL syntax is the same as joining two tables native to that database

example:
Select * from Customers, Orders where Orders.CustID = Customers.CustID

Customers could be an attached table from another database, or it could be a regular table in the same DB

HTH

Tom