Results 1 to 6 of 6

Thread: Changing 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.[/b]

    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


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

    I see Tech People ...

  2. #2
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Boulder, Colorado, USA
    Posts
    325
    look at the "UPDATE" SQL command
    -Shickadance

  3. #3
    Guest
    Sub Test()

    Dim cm As New ADODB.Command, i as Integer

    With cm
    .CommandType = adCmdText
    .ActiveConnection = GetConn() ' Get a connection here
    For i = 1 To 3
    .CommandText = "Update Table" & i & " Set USER_NAME = 'Harry' Where USER_NAME = 'Tom'"
    .Execute
    Next
    End With

    Set cm = Nothing

    End Sub

  4. #4
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Taipei
    Posts
    318

    Talking

    May be a bit off topic.

    I am new to ADO, and very confused with the connections when going through the manuals.

    Could anybody give me some example for the following:

    1) Connect to local (LAN) SQL Server

    2) Connect to remote (Through TCP/IP) SQL Server

    Assume that the TCP/IP is 210.67.167.110
    the DB Name is Test
    User id is 'chong'
    Password is 'kitty'

    Sory for off topic since I am desparate in the connection string.

  5. #5
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Boulder, Colorado, USA
    Posts
    325
    I wrote a nice ADO wrapper class which makes ADO much easier.. I can post it later if you want. It allows for all types of connections. SQL, text, DSN, XLS, FOXPRO, etc...
    -Shickadance

  6. #6
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Taipei
    Posts
    318

    Talking

    Shickadance,

    Please post it ASAP



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