<%
db= "Db1.mdb"
Path=server.mappath (DB)
Set Conn=server.createobject ("ADODB. Connection ")
Connstr= "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" &path
Conn. Open ConnStr
Set Rs=server. CreateObject ("Adodb.recordset")
'===========================================
' function function: Data Bulk Import
' Author: wangsdong
' Article for the author original, reproduced please indicate the origin of the article, reserved for
' Person information, thank you for your support!
' Principle: Import data from Excel into Access
'===========================================
' Connecting to the Excel database tutorial
Path= "./"
Dim Xlsconn,strsource,xlbook,xlsheet,i
Dim Myconn_xsl,xlsrs,sql,objcmd
Set xlsconn = server. CreateObject ("Adodb.connection")
Set Xlsrs = Server.CreateObject ("Adodb.recordset")
Filename= "Merchandise"
file2= "Product List"
Source=server.mappath (path&filename& ". xls")
Myconn_xsl= "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" "&source&"; Extended Properties=excel 8.0 "
Xlsconn.open myconn_xsl
sql = "SELECT * FROM [" &file2& "$]"
Xlsrs.open sql,xlsconn,1,1
If xlsrs.eof Then
Else
I=1
Response.Write "<table border=1>"
Do as not xlsrs.eof
Goods_name=xlsrs ("Commodity name")
Goods_images=xlsrs ("Picture")
CAT_ID=XLSRS ("Commodity Classification")
%>
<TR>
<TD> <%=goods_name%></TD>
<TD> <%=goods_images%></TD>
<TD> <%=cat_id%></TD>
</TR>
<%
Sql= INSERT into goods (goods_name,goods_images,cat_id) VALUES (' &goods_name& ', ' &goods_images& ' , "&cat_id&") "
Conn.execute (SQL)
I=i+1
Xlsrs. MoveNext
Loop
Response.Write "</table>"
End If
Xlsrs.close
Response.Write "Total import <font color= ' Red ' >" & i-1 & "</font> Strip record .<br>" & VbCrLf
Set xlsconn=nothing
Set objcmd=nothing
%>
Access structure
Goods_name,goods_images cat_id
Excel structure
Product name, picture, product category