CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2001
    Posts
    7

    Table Comparasion

    How can I compare two tables on two diferent SQL servers using ADO. Thanx


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Table Comparasion

    you can create 2 recordsets (one from each table) and then you can compare recordsets

    Dim dbcurrent As Database
    Dim qryMyQuery As QueryDef
    Dim recMatching as Recordset
    ' Set the database
    Set dbcurrent = OpenDatabase("c:\my files\myData.mdb")

    'Create a Query
    Set qryMyQuery = dbcurrent.CreateQueryDef(MyQuery, "SELECT * FROM [Tablename] WHERE [Exclusions]")

    Your next move is to create a recordset based upon the matching criteria......

    Set recMatching = dbcurrent.OpenRecordset("SELECT * FROM [Table2] INNER JOIN [MyQuery] ON [Table2].[common
    field] = [MyQuery].[Common Field]")


    The recordset will now contain all the matching criteria that you will be able to manipulate in whatever
    form you like.


    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Table Comparasion

    I forgot to mention, that if you want to use ADO you can use the same approach, only instead the query write records to the temp table (which you can create in advance or on the fly)

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

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

Featured