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$]" %>