Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 881323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:14:29+00:00 2026-05-15T12:14:29+00:00

here is the connection i have strCon=DBQ= & Server.Mappath(db.mdb) & ;Driver={Microsoft Access Driver (*.mdb)};PWD=password;

  • 0

here is the connection i have

strCon="DBQ=" & Server.Mappath("db.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};PWD=password;"
set adoCon=server.createobject("adodb.connection")
adoCon.Open strCon

so in order to work with the 2 databases i have 2 adoCon and when i do the select i select from each db i need

now for the problem…
in this situation i will be able only to get all the info from one and then from the other one. but what i want is to be able to put the together.

db1.tblcats has categories and db2.tblcats has categories and subcategories
so in addition to be able to select both of the together, i need to be able to know what cat is from what db


Step 2 after the big help

this is my code

strSQL = "SELECT name FROM tblcats union " _ 
& "select name from [MS Access;PWD=pass;DATABASE=" & Server.Mappath("../shop.mdb") & "].tblcats as bcats where bcats.father=50"
                                rs.CursorType = 3
                                rs.LockType = 3
                                rs.Open strSQL, strCon
while not rs.eof
response.write rs("name")&"<br>"
rs.movenext
wend

how can i know what record came from what db? cause i need to act difrently for each one

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T12:14:30+00:00Added an answer on May 15, 2026 at 12:14 pm

    You can use IN:

    SELECT t1.*, t2.* 
    FROM T1 
    INNER JOIN 
    (SELECT * FROM atable 
    IN 'C:\Docs\DB2.mdb') t2
    ON t1.ID=t2.ID
    

    EDIT:

    sc = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\docs\other.mdb"
    cn.open sc
    
    s="SELECT * FROM t1 INNER JOIN " _
    & "[MS Access;PWD=databasePWD;DATABASE=C:\docs\db.mdb].t2 ON t1.ID=t2.ID"
    
    rs.Open s, cn
    

    EDIT 2:

    You can use the aliases to identify which database a field is from:

    s="SELECT * FROM table1 t INNER JOIN " _
    & "[MS Access;PWD=databasePWD;DATABASE=C:\docs\db.mdb].m ON t.ID=m.ID"
    
     msgbox rs.fields("m.code") & " " & rs.fields("t.code")
    

    EDIT 3

    Or you can add a virtual field:

     SELECT 1 AS "DB", Field, Field FROM  ...
     UNION ALL
     SELECT 2 AS "DB", Field, Field FROM
    

    UNION ALL is usually faster.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.