db.execute "update table1 set * =(select * from table2 where table2.coll=table1.coll" 不是rs.fields,是table2.coll
update table1 set col1=table2.col1, col2=table2.col2, ... from table2 where table1.id=table2.id
coll等于rs![fields],id等于字段名,对吗?
Dim conn As ADODB.Connection Dim SQLServerConnect As String, SQLUpdate As String SQLServerConnect = "Driver={SQL Server};Server=TCL;Database=库A;" & _ "UID=sa;PWD=;" '连接字符串 Set conn = New ADODB.Connection conn.ConnectionString = SQLServerConnect conn.Open SQLUpdate = "update [库A]..[表A] set [库A]..[表A].[字段A]=[库B]..[表B].[字段B] from [库A]..[表A], [库B]..[表B] where [库A]..[表A].[Aid]=[库B]..[表B].[Bid]" conn.Execute SQLUpdate
不是rs.fields,是table2.coll
set col1=table2.col1,
col2=table2.col2,
...
from table2
where table1.id=table2.id
Dim SQLServerConnect As String, SQLUpdate As String
SQLServerConnect = "Driver={SQL Server};Server=TCL;Database=库A;" & _
"UID=sa;PWD=;" '连接字符串
Set conn = New ADODB.Connection
conn.ConnectionString = SQLServerConnect
conn.Open
SQLUpdate = "update [库A]..[表A] set [库A]..[表A].[字段A]=[库B]..[表B].[字段B] from [库A]..[表A], [库B]..[表B] where [库A]..[表A].[Aid]=[库B]..[表B].[Bid]"
conn.Execute SQLUpdate