-
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
-
look at the "UPDATE" SQL command :)
-
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
-
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.
-
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,
Please post it ASAP