用ASP实现从SQL Server导出数据到Access

2018-09-06 11:49

阅读:459

  用ASP实现从SQLServer导出数据到Access


方法其实很简单:需要在SQLServer连接中嵌套一个access连接,然后逐条
写入就可以了。

Conn.Opendriver={SQLserver};server=mamaco;uid=linner;pwd=123;dat
abase=linner
sql=select*fromscjh
setrs=conn.execute(sql)%>
<%setConn1=Server.CreateObject(ADODB.Connection)
param=driver={MicrosoftAccessDriver(*.mdb)}
conn.Openparam;dbq=Server.MapPath(scjh.mdb)
conn1.execute(deletefromscjh)%>
<%dowhilenotrs.eof%>
<%dimktdh,scph,scts,jhqtsj,yhxdsj,yxj,rwbh
ktdh=rs(ktdh)
scph=rs(scph)
scts=rs(scts)
jhqtsj=rs(jhqtsj)
yhxdsj=rs(yhxdsj)
yxj=rs(yxj)
rwbh=rs(rwbh)
%>
<%sql1=insertintoscjh(ktdh,scph,scts,jhqtsj,yhxdsj,yxj,rwbh)values


(ktdh,scph,scts,jhqtsj,yhxdsj,


yxj,rwbh)
conn1.execute(sql1)%>
<%rs.movenext
loop
conn1.close
conn.close%>
<%response.redirect/download/scjh.mdb%>


评论


亲,登录后才可以留言!