<!--#include file="../opendb.asp"-->
<title>生成报表</title>
<%
'action=request("action")
'if action="make_excel" then
set conn=server.CreateObject("adodb.connection")
conn.Open ConnStr
dim rs,sql,filename,fs,myfile,x
Set fs = server.CreateObject("scripting.filesystemobject")
filepath=Request.ServerVariables("APPL_PHYSICAL_PATH")
filename = filepath&"jdxx\temp_xls\"&session("maindanwei")&"_jdxx_"&year(now)&month(now)&day(now)&".xls"
if fs.FileExists(filename) then
fs.DeleteFile(filename)
end if
set myfile = fs.CreateTextFile(filename,true)
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "select * from jdxx where 台站='"&session("maindanwei")&"'"
rs.Open sql,conn,1,1
if rs.EOF and rs.BOF then
else
dim strLine,responsestr
strLine=""
For each x in rs.fields
strLine = strLine & x.name & chr(9)
Next
myfile.writeline strLine
Do while Not rs.EOF
strLine=""
for each x in rs.Fields
strLine = strLine & x.value & chr(9)
next
myfile.writeline strLine
rs.MoveNext
loop
end if
rs.Close
set rs = nothing