<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>export</title> </head> <!--#include file="../Include/Const.asp" --> <!--#include file="../Include/ConnSiteData.asp" --> <body> <% '设置页面时间 Server.ScriptTimeOut=999999 dim s,sql,filename,fs,myfile,x,mFileName,ObjExcel,ObjSheet Set fs = server.CreateObject("scripting.filesystemobject") filename = Server.MapPath("contact.csv") '--如果原来的EXCEL文件存在的话删除它 if fs.FileExists(filename) then fs.DeleteFile(filename) end if '--创建csv文件 set myfile = fs.CreateTextFile(filename,true) '--从数据库中把你想放到csv中的数据查出来 strSql = "select * from Ameav_Contact order by OrgName asc" '--显示执行的SQL语句 Response.Write "<div id='sql'><strong>SQL 语句:</strong><br />"&strSql&"</div>" Set Rs =conn.execute(strSql) if not Rs.EOF and not Rs.BOF then dim trLine,responsestr strLine="" For each x in Rs.fields strLine = "OrgName,DepName,StaffName,Office,SubPhone,DirecPhone,Telephone,PersonEmail,CompanyEmail,Password,Remark"'Public,Password,Remark" Next myfile.writeline strLine Response.Write "<div id='data'>" Do while Not Rs.EOF strLine="" strLine= Rs("OrgName")&"," & Rs("DepName")&"," & Rs("StaffName") & "," & Rs("Office") & "," & Rs("SubPhone") & "," & Rs("DirecPhone") & "," & Rs("Telephone") & "," & Rs("PersonEmail") & "," & Rs("CompanyEmail") & "," & Rs("Password") & "," & Rs("Remark")'& Rs("Public") & "," & Rs("Password") & "," & Rs("Remark") if WriteDB=True then Response.Write strLine & "<br /><hr />" end if myfile.writeline strLine Rs.MoveNext loop Response.Write "</div>" end if Response.Write "<div id='down'><p><a href=""contact.csv"" target=""_blank"">生成文件成功,点击下载!</a></p></div>" Rs.Close :set Rs = nothing Conn.Close:Set Conn = nothing %> </body> </html>
详细解决方案
asp从access导出替csv文件
热度:274 发布时间:2012-10-06 17:34:01.0
相关解决方案
- java.sql.SQLException: Access denied for user 'root'@'localhost' (using password,该如何处理
- java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] 找不到资料 '(未知的)'
- java.sql.SQLException: Access denied for user 'root'@'localhost' (using password解决思路
- jsp access 图片调用的有关问题
- 小弟我用JSP+ACCESS+tomcat 5.0 JDK1.4做的一个网站
- 出现异常:cvs [server aborted]:"passwd" requires write access to the repository
- java.lang.SecurityException: Application not authorized to access the restricted API有关问题,
- java and access,该如何解决
- java.security.AccessControlException: access denied (java.lang.
- java.security.AccessControlContext.checkPermission:access denied
- 何为原子访问(atomic access)解决方案
- 作甚原子访问(atomic access)
- 继续:vs2005 vc access 取不到表中的数据,该如何解决
- 持续:vs2005 vc access 取不到表中的数据
- vs2005,vc access MoveNext()
- dax error : access violation at address解决办法
- Delphi程序写的EXCEL导入程序时报错:Access violation at address0057416f in module"serv"exe,该怎么解决
- dax error : access violation at address,该如何解决
- Mapabc老是报错“Access Denied,Status=4,Host=AN_Tianjin_28_100”,高分求指教
- Access to report file denied. Another program may be using it.(水晶报表导出PDF时的异常)
- asp.net+access,批量替换access内容解决方案
- access 后盾更新
- access like 内存储器溢出
- asp.net+access,批量轮换access内容
- Access Update 替select值出错 操作必须使用一个可更新的语句
- cannot access private field 'key' here解决办法
- ACCESS 怎的获得刚插入数据的ID
- asp.net access update 语句 语法异常 质疑
- access 查询语句的有关问题
- 网站间接性出现空缺 整站没有数据,是什么原因啊(net+access)