从A表中读出数据写入B表
A.B表分别位于不同数据库中,AB表名称结构字段完全一样,现在想将A表中的信息写入B表中,代码如下<!-- #include file = "../common/site.inc" -->
<!-- #include file = "../common/site1.inc" -->
<%
dim rs
set rs=cn.execute ("select StudentID,password,teacher,xb,xy,zy,bj,nj,ph,sfz,bmsj from student")
if not (rs.eof and rs.bof) then '如果账号存在
do while not rs.eof ’循环开始
dim A_StudentID,A_password,A_xb,A_xy,A_zy,A_bj,A_nj,A_ph,A_sfz,A_bmsj
A_StudentID=rs("StudentID")
A_password=rs("password")
A_xb=rs("xb")
A_xy=rs("xy")
A_zy=rs("zy")
A_bj=rs("bj")
A_nj=rs("nj")
A_ph=rs("ph")
A_sfz=rs("sfz")
A_bmsj=rs("bmsj")
set rs1=server.createobject("adodb.recordset")
sql="select StudentID,password,teacher,xb,xy,zy,bj,nj,ph,sfz,bmsj from student where StudentID='"&A_StudentID&"'" '用A的账号作为查询条件在B表里查询;
rs1.open sql1,cn1,1,3
rs1("password")= A_password
rs1("xb")= A_xb
rs1("xy")= A_xy
rs1("zy")= A_zy
rs1("nj")= A_nj
rs1("bj")= A_bj
rs1("ph")= A_ph
rs1("sfz")= A_sfz
rs1("bmsj")= A_bmsj
rs1.update
rs1.close
rs.movenext
loop
else
response.write ("A表没有数据")
end if
rs.close
set rs=nothing
%>
提示出错,帮忙看看,谢谢、