[英]Classic asp code to export data from Access database to an Excel sheet
我有一個使用經典ASP編碼和HTML頁面運行的應用程序,而在一個.asp
頁面中,客戶端要求按鈕。 單擊此按鈕時,它必須將Access Table數據庫(已在使用中)中存在的所有數據導出到excel工作表中。
您可以生成帶有HTML表的xls擴展名的文件,並且Excel將會打開(帶有警告)。 例:
text.asp
<html>
<head>
</head>
<body>
<%
Response.clear
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment;filename=ExportedData.xls"
Response.Write "<table>"
Response.Write "<tr><th>User</th></tr>"
set rs = ListUsers()
if not rs.EOF Then
Do while not rs.eof
Response.Write "<tr><td>" + rs("User") + "</td></tr>"
Rs.movenext
loop
end if
Response.Write "</table>"
Response.end
%>
</body>
</html>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.