(新手求助)ASP中比较二服务器表1和表2中的数据差异,删除表1中多于表2的数据
<%set conn1=server.createobject("adodb.connection")strConn1 = "Provider=Sqloledb;User ID=sa;Password=123;Initial Catalog=web;Data Source=(local)"
Conn1.open strConn1
set rs1=server.createobject("adodb.recordset")
rs1.open "Select * From 表1",Conn,0,1
t1=rs1("name")
do while not rs1.eof
%> <%
set conn2=server.createobject("adodb.connection")
strConn2 = "Provider=Sqloledb;User ID=sa;Password=123;Initial Catalog=web;Data Source=192.168.0.1"
Conn2.open strConn2
set rs2=server.createobject("adodb.recordset")
rs2.Open "Select * from 表2 where name='"&t1&"'",conn2,1,1
if rs2.eof then
conn1.Execute("delete 表1 where name='"&t1&"'")
end if
ors.MoveNext
loop
rs1.close
set rs1=nothing
%>
大概就是这样:我想本机数据库中的,表1中name字断依依在另台服务器上表2中查询是否有此数据,如果没有那就删除表1中的数据!!!!
我上面的代码无报错,但无效果,请高手指点下