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

  • 内容
  • 评论
  • 相关

方法其实很简单:需要在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)}"

http://www.gaodaima.com/66131.htmlasp实现从SQL Server导出数据到Access_asp

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"%> 

欢迎大家阅读《用ASP实现从SQL Server导出数据到Access_asp》,跪求各位点评,若觉得好的话请收藏本文,by 搞代码

原创文章,转载请注明: 转载自搞代码

本文链接地址: 用ASP实现从SQL Server导出数据到Access_asp

微信支付二维码

微信 赏一包辣条吧~

支付宝支付二维码

支付宝 赏一听可乐吧~

评论

0条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注