aspexcel导入access源码
Ⅰ 鍝浣嶅ぇ绁炶兘鍙戜竴涓猘sp瀵煎嚭excel琛ㄦ牸镄勪唬镰侊纻鎴戠敤镄勬槸access鏁版嵁搴掳纴姣忚屼唬镰佹渶濂借︾粏璇存槑锛佽阿璋㈠暒
<!--#include file="comm.asp"-->
<meta http-equtv="Content-Type" content="text/html; charset=gb2312" />
<%
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment; filename=瀵煎嚭钖峗"&date()&".xls"
mytype=Request.QueryString("mytype")
SET rs_kh=SERVER.CreateObject("ADODB.RECORDSET")
sql="SELECT * FROM [ZhuJi] ORDER BY EDate"
rs_kh.open sql,conn,1,1
if Not rs_kh.eof then
Response.Write "<table border=""1"" bordercolor=""#999999"" style=""border-collapse: collapse"">"
Response.Write "<tr> " & vbCrlf
Response.Write " <td colspan=""8"">涓婚桦悕</td></tr>" & vbCrlf
Response.Write "<tr bgcolor=""#f1f3f5"">" & vbCrlf
Response.Write " <td align=""center"">鍒楄〃1</td>" & vbCrlf
Response.Write " <td align=""center"">鍒楄〃2</td>" & vbCrlf
Response.Write " <td align=""center"">鍒楄〃3</td>" & vbCrlf
Response.Write " <td align=""center"">鍒楄〃4</td>" & vbCrlf
Response.Write " <td align=""center"">鍒楄〃5</td>" & vbCrlf
Response.Write " <td align=""center"">鍒楄〃6</td>" & vbCrlf
Response.Write " <td align=""center"">鍒楄〃7</td>" & vbCrlf
Response.Write " <td align=""center"">鍒楄〃8</td>" & vbCrlf
Response.Write " <td align=""center"">QQ</td>" & vbCrlf
Response.Write " <td align=""center"">搴ф満</td>" & vbCrlf
Response.Write " <td align=""center"">镓嬫満</td>" & vbCrlf
Response.Write " <td align=""center"">镓灞炰笟锷</td>" & vbCrlf
Response.Write " <td align=""center"">链烘煖</td>" & vbCrlf
Response.Write " <td align=""center"">浠锋牸</td>" & vbCrlf
Response.Write " <td align=""center"">寮濮嬫棩链</td>" & vbCrlf
Response.Write " <td align=""center"">宸蹭娇鐢</td>" & vbCrlf
Response.Write " <td align=""center"">缁撴潫镞ユ湡</td>" & vbCrlf
Response.Write " <td align=""center"">绫诲埆</td>" & vbCrlf
Response.Write "</tr>" & vbCrlf
do while not rs_kh.eof
Response.Write "<tr> " & vbCrlf
Response.Write "<td height=""20"">"&rs_kh("ZJ_BianHao")&"</td>" & vbCrlf
%>
<td align=""center""><%SET rs_ip=SERVER.CreateObject("ADODB.RECORDSET")
sqlip="SELECT * FROM [ip] Where zjid='"&rs_kh("id")&"'"
rs_ip.open sqlip,conn,1,1
IF rs_ip.eof or rs_ip.bof THEN
'response.write "<a href='IP_GL.asp?zjid="&rs_kh("id")&"' target=_blank>[IP绠$悊]</a>"
'response.End()
END IF%>
<%for l =1 to rs_ip.recordcount%>
<%if rs_ip.EOF then
exit for
end if%>
<% Response.Write " "&rs_ip("IP")&"<br />" & vbCrlf %>
<%rs_ip.movenext
NEXT%></td>
<%
SET rsphao=SERVER.CreateObject("ADODB.RECORDSET")
sqlphao="SELECT * FROM [phao] Where ZJ_bh='"&rs_kh("ZJ_BianHao")&"'"
rsphao.open sqlphao,conn,1,1
IF rsphao.eof or rsphao.bof THEN
Response.Write " <td align=""center"">镓樼</td>" & vbCrlf
Else
Response.Write " <td align=""center"">"&rsphao("CPU")&"</td>" & vbCrlf
End IF
%>
<%
SET rspnc=SERVER.CreateObject("ADODB.RECORDSET")
sqlnc="SELECT * FROM [phao] Where ZJ_bh='"&rs_kh("ZJ_BianHao")&"'"
rspnc.open sqlnc,conn,1,1
IF rspnc.eof or rspnc.bof THEN
Response.Write " <td align=""center""> </td>" & vbCrlf
Else
Response.Write " <td align=""center"">"&rspnc("MC")&"</td>" & vbCrlf
End IF
%>
<%
SET rsyp=SERVER.CreateObject("ADODB.RECORDSET")
sqlyp="SELECT * FROM [phao] Where ZJ_bh='"&rs_kh("ZJ_BianHao")&"'"
rsyp.open sqlyp,conn,1,1
IF rsyp.eof or rsyp.bof THEN
Response.Write " <td align=""center""> </td>" & vbCrlf
Else
Response.Write " <td align=""center"">"&rsyp("yp")&"</td>" & vbCrlf
End IF
Response.Write " <td align=""center"">"&rs_kh("daikuang")&"鍏</td>" & vbCrlf
%>
<%SET rs=SERVER.CreateObject("ADODB.RECORDSET")
sqls="SELECT * FROM [KeHu] Where ID='"&rs_kh("KeHu_id")&"'"
rs.open sqls,conn,1,1
%>
<%SET rs_yw=SERVER.CreateObject("ADODB.RECORDSET")
sqlyw="SELECT * FROM [chloome] Where ID='"&rs_kh("Yw_ID")&"'"
rs_yw.open sqlyw,conn,1,1
%>
<%IF rs.eof or rs.bof THEN
Response.Write " <td align=""center"">"&rs_yw("UserName")&"</td>" & vbCrlf
ELSE
Response.Write " <td align=""center"">"&rs("UserName")&"</td>" & vbCrlf
End IF%>
<%
Response.Write " <td align=""center"">"&rs("LianXiRen")&"</td>" & vbCrlf
Response.Write " <td align=""center"">"&rs("qq")&"</td>" & vbCrlf
Response.Write " <td align=""center"">"&rs("zuoji")&"</td>" & vbCrlf
Response.Write " <td align=""center"">"&rs("shouji")&"</td>" & vbCrlf
Response.Write " <td align=""center"">"&rs_yw("UserName")&"</td>" & vbCrlf
Response.Write " <td align=""center"">"&rs_kh("JiGui")&"</td>" & vbCrlf
Response.Write " <td align=""center"">"&rs_kh("JiaGe")&"鍏</td>" & vbCrlf
Response.Write " <td align=""center"">"&rs_kh("BDate")&"</td>" & vbCrlf
Response.Write " <td align=""center"">"&rs_kh("ShiChang")&"涓链</td>" & vbCrlf
Response.Write " <td align=""center"">"&rs_kh("EDate")&"</td>" & vbCrlf
%>
<%if rs_kh("TagGuiShu")=0 then
Response.Write " <td align=""center"">镓樼</td>" & vbCrlf
elseif rs_kh("TagGuiShu")=1 then
Response.Write " <td align=""center"">绉熺敤</td>" & vbCrlf
else
Response.Write " <td align=""center"">链烘煖</td>" & vbCrlf
end if
%>
<%
Response.Write "</tr>" & vbCrlf
rs_kh.movenext
Loop
Response.Write "</table>" & vbCrlf
else
Response.Write "娌℃湁镓惧埌鐩稿叧璁板綍" & vbCrlf
end If
rs_kh.close
set rs_kh=Nothing
%>
Ⅱ [ASP源码]求一个可用Excel数据批量导入到Access的ASP程序
只能提供给你思路。 很简单,ASP中可以把Excel当做数据库来使用,程序中建立两个连接,一个连接你的Access,另一个连接到Excel,然后查询Excel中的数据,再写入到Access。查询语句跟Access一样。 asp连接excel的方法与代码: <% dim connxls,connstrxls connstrxls="DBQ=d:\newexcel.xls;DefaultDir=;DRIVER={Microsoft Excel Driver (*.xls)};" set connxls=server.createobject("ADODB.CONNECTION") connxls.open connstrxls Set rsxls=Server.CreateObject("ADODB.Recordset") SQLxls = "select * from [new$]" %>