PDA

Click to See Complete Forum and Search --> : Change Data - (The Easiest Way) - ADO


omarswan
May 30th, 2000, 03:08 AM
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]

Gary.Lowe
May 30th, 2000, 06:35 PM
omarswan

Its basic but Should work


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

omarswan
May 30th, 2000, 11:27 PM
:) Thanks Alot Gary :)

:) May God Bless You :)