日期:2014-05-16 浏览次数:21034 次
<!--#include file="inc/sys_conn.asp"-->
<%
Set fs = server.CreateObject("scripting.filesystemobject")
a=year(now())&"-"&month(now())&"-"&day(now())
filename = Server.MapPath("/pqyg/date/pqyg_"&a&".xls")
if fs.FileExists(filename) then
fs.DeleteFile(filename)
end if
set myfile = fs.CreateTextFile(filename,true)
strSql = "select * from person where p_state<>'离职'"
Set rstData =conn.execute(strSql)
if not rstData.EOF and not rstData.BOF then
dim trLine,responsestr
strLine=""
For each x in rstData.fields
strLine = strLine & x.name & chr(9)
Next
'--将表的列名先写入EXCEL
myfile.writeline strLine
Do while Not rstData.EOF
strLine=""
for each x in rstData.Fields
strLine = strLine &"'"& x.value & "'"& chr(9)
next
myfile.writeline strLine
rstData.MoveNext
loop
end if
Response.Write "生成EXCEL文件成功,点击<a href=""/pqyg/date/pqyg_"&a&".xls"" target=""_blank"">下载</a>!"
rstData.Close
set rstData = nothing
Conn.Close
Set Conn = nothing
%>
Set fs = server.CreateObject("scripting.filesystemobject")
a=year(now())&"-"&month(now())&"-"&day(now())
filename = Server.MapPath("/pqyg/date/pqyg_"&a&".xls")
if fs.FileExists(filename) then
fs.DeleteFile(filename)
end if
set myfile = fs.CreateTextFile(filename,true)
function cnname(v)'''''''''
select case v
case "name" cnname="姓名"
case "idcard" cnname="身份证"
'.....其他case语句
end select
end function