日期:2014-05-17  浏览次数:21106 次

利用asp导出SQL查询结果到excel?
如题,要求可实现保存数据到客户端.最好说具体些,谢谢,因为没有接触过这类。

------解决方案--------------------
网上很多,搜搜
参考:
http://hi.baidu.com/psc2006hedan/blog/item/dd05b599ca8ccf0a6e068cd5.html
------解决方案--------------------
select case 导出类型
case "excel "
response.contenttype= "application/vnd.ms-excel "
case "word "
response.contenttype= "application/msword "
end select

response.contenttype 必须写在BODT 之前
------解决方案--------------------
<%@ Language=VBScript%>
<%
Response.Clear
Response.ContentType = "text/xls "
Response.AddHeader "content-disposition ", "attachment; filename=export.xls "
response.write "Col1 "&chr(9) & "Col2 "&chr(9) & "Col3 "&chr(9) & "Col4 "&chr(9) & "Col5 "&chr(9) & "Col6 "&chr(9) &chr(13)
for i= 1 to 10
Data=Data & i & chr(9)
next
Response.Write Data&chr(13)
Response.Flush
Response.End
%>
執行這個asp就可