ASP tips: export data from SQL Server to access

Source: Internet
Author: User

The method is actually very simple: you need to nest an access connection in the SQL server connection, and then one by one
Write.

<% Set conn = server. Createobject ("ADODB. Connection ")
Conn. Open "driver = {SQL Server}; server = mamaco; uid = linner; Pwd = 123; dat
Abase = linner"
SQL = "select * From scloud"
Set rsw.conn.exe cute (SQL) %>
<% Set conn1 = server. Createobject ("ADODB. Connection ")
Param = "driver = {Microsoft Access Driver (*. mdb )}"
Conn. Open Param & "; DBQ =" & server. mappath ("scloud. mdb ")
Conn1.execute ("delete from scloud") %>
<% 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 scloud (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/scloud. 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.