Results 1 to 7 of 7

Thread: Copy data from one database to another???

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Location
    Kalix, Norrbotten, SWEDEN
    Posts
    343

    Copy data from one database to another???

    I want to copy data from one database to another database. The databases are access and I want to use ADO in VB to do this. Any suggestions??

    /Smirre
    Visual Basic
    C, C++
    Java
    Access
    SQL Server

    MCP, MCSD

  2. #2
    Hyperactive Member
    Join Date
    May 2001
    Location
    Beirut, Lebanon
    Posts
    318
    You can do it in two ways:

    1- use two ADO connections, loop through the records of the tables of the first database, and add new records in the other.

    2- Create linked tables in the destination database that reference the source database and use an Insert query to copy the records.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Location
    Kalix, Norrbotten, SWEDEN
    Posts
    343
    You mean that I should use the addnew method of the recordset object??

    Can this be done with out using the addnew method of the recordset object.

    /Smirre
    Visual Basic
    C, C++
    Java
    Access
    SQL Server

    MCP, MCSD

  4. #4
    Hyperactive Member
    Join Date
    May 2001
    Location
    Beirut, Lebanon
    Posts
    318
    You can either use the AddNew Method, or you can use the Execute method directly from the connection.

    mConn.Execute "Insert Into table1 (field1, field2, field3) values (value1, value2, value3)"

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Location
    Kalix, Norrbotten, SWEDEN
    Posts
    343
    Ok, never thought of that.

    What are pro and cons with your two suggested ways of doing this??

    What way do you think would be the fastest and the "safest". This operation is going to run every 20 minutes.

    /Smirre
    Visual Basic
    C, C++
    Java
    Access
    SQL Server

    MCP, MCSD

  6. #6
    Hyperactive Member
    Join Date
    May 2001
    Location
    Beirut, Lebanon
    Posts
    318
    It's of course faster to use the Execute method.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Location
    Kalix, Norrbotten, SWEDEN
    Posts
    343
    I meant the first two options you suggested. connections vs linked....

    I know that the execute will be faster than the and new method of the recordset.

    /Smirre
    Visual Basic
    C, C++
    Java
    Access
    SQL Server

    MCP, MCSD

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