ASP exports data from SQL Server to access

Source: Internet
Author: User

The approach is simple: you need to nest an access connection in a SQL Server connection, and then
Write to it.

<%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 & ";d bq=" & 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"%>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.