Results 1 to 3 of 3

Thread: Change Data - (The Easiest Way) - ADO

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240

    Question

    Hi everyone,

    I have a database that has 3 Tables, none of them are linked together.

    This is the Structure of the Database


    Table1
    Table1_Field1
    Table1_Field2
    Table1_Field3
    USER_NAME


    Table2
    Table2_Field1
    Table2_Field2
    Table2_Field3
    USER_NAME


    Table3
    Table3_Field1
    Table3_Field2
    Table3_Field3
    USER_NAME


    If you notice, USER_NAME is common in the 3 tables. Now here is the question. What is the easiest way to change the value for USER_NAME from "Tom" to "Harry", in all the 3 tables?

    P.S. I'm using ADO

    [Edited by omarswan on 05-30-2000 at 04:09 PM]
    Omar
    [email protected]
    http://omar.caribwalk.com
    To God Be The Glory

    I see Tech People ...

  2. #2
    Fanatic Member Gary.Lowe's Avatar
    Join Date
    May 2000
    Location
    In my sphere of influence
    Posts
    621
    omarswan

    Its basic but Should work

    Code:
    Dim sSQL as string 
    
    sSQL = "UPDATE Table1 SET Table1.user_Name = 'Harry'" _
    & " WHERE (((Table1.user_Name)='tom'));"
    
    cnn.Execute sSQL
    
    sSQL = "UPDATE Table2 SET Table2.user_Name = 'Harry'" _
    & " WHERE (((Table2.user_Name)='tom'));"
    
    cnn.Execute sSQL
    
    sSQL = "UPDATE Table3 SET Table3.user_Name = 'Harry'" _
    & " WHERE (((Table3.user_Name)='tom'));"
    
    cnn.Execute sSQL
    You may have to wrap it all in transactions to make sure no one is editing records the same time you are

    Gazza


  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240

    Smile Thanks Alot Gary

    Thanks Alot Gary

    May God Bless You
    Omar
    [email protected]
    http://omar.caribwalk.com
    To God Be The Glory

    I see Tech People ...

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