欢迎光临
我们一直在努力

用asp实现从sql server导出数据到access _asp技巧

建站超值云服务器,限时71元/月

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

<%set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "driver={SQL server};server=mamaco;uid=linner;pwd=123;dat
abase=linner"
sql="select * from scjh"
set rs=conn.execute (sql)%>
<%set Conn1 = Server.CreateObject("ADODB.Connection")
param = "driver={Microsoft Access Driver (*.mdb)}"
conn.Open param & ";dbq=" & Server.MapPath("scjh.mdb")
conn1.execute("delete from scjh")%>
<%do while not rs.eof%>
<%dim ktdh,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="insert into scjh(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"%>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 用asp实现从sql server导出数据到access _asp技巧
分享到: 更多 (0)