Results 1 to 5 of 5

Thread: Populate Recordset from 2 Databases

  1. #1

    Thread Starter
    Fanatic Member JCScoobyRS's Avatar
    Join Date
    Oct 2002
    Location
    Some Mountain in Colorado
    Posts
    677

    Populate Recordset from 2 Databases

    I am having trouble creating a recordset that gets records from two different tables in two different databases. I'm using Oracle 8i and I have tried everything. Has someone tried this and been successful and if so, could you help? Thanks, Jeremy
    He who listens well, speaks well.

  2. #2
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    2 connectionStrings
    2 Recordsets
    VB Code:
    1. Dim conn1 As ADODB.Connection
    2.    Dim conn2 As ADODB.Connection
    3.    Dim rs1 As ADODB.Recordset
    4.    Dim rs2 As ADODB.Recordset
    5.    Dim sql1 As String
    6.    Dim sql2 As String
    7.  
    8.    Set conn1 = 'your first ConnectionString
    9.    Set conn2 = 'your second ConnectionString
    10.  
    11.    Set sql1 = "SELECT * FROM TableName"
    12.    Set sql2 = "SELECT * FROM TableName"
    13.  
    14.    rs1.Open(sql1, conn1, 3, 3)
    15.    rs2.Open(sql2, conn2, 3, 3)
    16.    
    17.    do until rs1.eof
    18.       'do whatever
    19.       rs1.movenext
    20.    loop
    21.  
    22.    do until rs2.eof
    23.       'do whatever
    24.       rs2.movenext
    25.    loop
    26.  
    27.    conn1.close
    28.    conn2.close
    29.    rs1.close
    30.    rs2.close
    31.  
    32.    Set conn1 = Nothing
    33.    Set conn2 = Nothing
    34.    Set rs1 = Nothing
    35.    Set rs2 = Nothing
    36.    Set sql1 = Nothing
    37.    Set sql2 = Nothing
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  3. #3

    Thread Starter
    Fanatic Member JCScoobyRS's Avatar
    Join Date
    Oct 2002
    Location
    Some Mountain in Colorado
    Posts
    677
    Is there a way to combine 2 recordsets to hold only distinct information and then sort it? Thanks, Jeremy
    He who listens well, speaks well.

  4. #4
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    What exactly are you trying to do?

    You can nest the recordsets and compare them as you progress through the records.
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  5. #5

    Thread Starter
    Fanatic Member JCScoobyRS's Avatar
    Join Date
    Oct 2002
    Location
    Some Mountain in Colorado
    Posts
    677
    I have just figured out a workaround. Since I can't have one recordset from two different databases, no matter how hard I try, I just worked around it. I had to populate a ComboBox with records from two tables in two different databases. I didn't want duplicates. I figured it out though. Thanks, Jeremy
    He who listens well, speaks well.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width