Results 1 to 2 of 2

Thread: Anyone have an idea how i can use vb to update an existing database?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 1999
    Location
    Brisbane, Qld, Australia
    Posts
    78

    Post

    Hi, I have an existing VB project that I have given to a user to test out. What I want to know is how do I update /upgrade the existing database if the user is already using an older version of the database. So, how can I extract the existing data from the old database and add it to the newly changed database with a few extra fields etc through VB. I need to gather atleast 2 tables from the old database and add them to the new one. These include the data from a 'Clients' table and a 'Results' table. Is it possible? and if so How and how do i cod e it? Thanks in advance to any help given.

    Mike


    [This message has been edited by Spawny (edited 09-13-1999).]

  2. #2
    Lively Member
    Join Date
    Jan 1999
    Posts
    82

    Post

    Hi,

    If the fields in the new database are not required fields (as in they can have null values) then what you could do is open two connections: one for the old database, and one for the new database. Select all your records from the each table (this can be done one at a time) then using a loop, insert each record into the new table

    do until recordset.eof
    sql = "INSERT INTO tablename (field names) VALUES (" & recordset(field1) & "," & recordset(field2) & ")"
    newdb.execute(sql)
    recordset.movenext
    loop

    field1 and field2 are the names of the fields in the old database.

    Hope this helps,
    Preeti

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