ASP navigation Excel data to MSSQL access MySQL data methods

Source: Internet
Author: User
Tags mssql

Here is a simple piece of ASP import Excel data to save to other data such as MSSQL access MySQL, etc. oh, well, crap don't say much to see the following code.

<!--#include file= "adoconn.asp"-->
<%
Set xlsconn = server. CreateObject ("Adodb.connection")
Set Rs=server. CreateObject ("Adodb.recordset")

Source1=server.mappath ("..") & "" &replace (Request ("path"), "/", "" "
Myconn_xsl= "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" "&source1&"; Extended Properties=excel 8.0 "
Xlsconn.open myconn_xsl

Sql= "SELECT * FROM [Product List $]"
Set Rs=xlsconn.execute (SQL)
If not rs.eof then
While not rs.eof
Names=rs ("Commodity name")
Pic=rs ("Picture")

sql= "INSERT into [Product] (Namese,pic) VALUES ('" & Names & "', '" & Pic & ")"
Conn.execute (SQL)

Rs.movenext
Wend

End If
Response.Write "Import Succeeded"
End If
%>

Data connection file <!--#include file= "adoconn.asp"-->

Set Rs=server. CreateObject ("Adodb.recordset")
db= "... /database/db11.mdb "
Set Conn=server. CreateObject ("Adodb.connection")
connstr= "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & Server.MapPath ( db)
Conn.Open connstr

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.