|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
ASP一般认为只能运行在IIS上,正如前面所提到的,这并不是十分正确,事实上,ASP也能运行在Apache上。ApacheASP可在任意Apache服务器上运行有限的ASP功能,所需做的,只需打开mod_perl。1、ASP文件:
<%@LANGUAGE="VBSCRIPT"%>
<%optionexplicit%>
<%
EXAMPLEAS:把数据库中一个天天24小时在耳目数放到一个EXCEL文件中往
AUTHOR:钢铁工人
EMAIL:hello_hhb@21cn.com
DATE:2001-3-25
TEST:在NT4,SP6,SQLSERVER7.0,EXCEL2000中测试经由过程
%>
<HTML>
<HEAD>
<metacontent="text/html;charset=gb2312"http-equiv="Content-Type">
<TITLE>天生EXCEL文件</TITLE>
</HEAD>
<body>
<ahref="dbtoexcel.asp?act=make">天生在耳目口的EXCEL</a>
<hrsize=1align=leftwidth=300px>
<%
ifRequest("act")=""then
else
dimconn
setconn=server.CreateObject("adodb.connection")
conn.Open"test","sa",""
conn.OpenApplication("connstr")
dimrs,sql,filename,fs,myfile,x,link
Setfs=server.CreateObject("scripting.filesystemobject")
--假定你想让天生的EXCEL文件做以下的寄存
filename="c:online.xls"
--假如本来的EXCEL文件存在的话删除它
iffs.FileExists(filename)then
fs.DeleteFile(filename)
endif
--创立EXCEL文件
setmyfile=fs.CreateTextFile(filename,true)
Setrs=Server.CreateObject("ADODB.Recordset")
--从数据库中把你想放到EXCEL中的数据查出来
sql="selectpopulation,hourpos,dateposfrompopulationperhourorderbydatepos,hourposasc"
rs.Opensql,conn
ifrs.EOFandrs.BOFthen
else
dimstrLine,responsestr
strLine=""
Foreachxinrs.fields
strLine=strLine&x.name&chr(9)
Next
--将表的列名先写进EXCEL
myfile.writelinestrLine
DowhileNotrs.EOF
strLine=""
foreachxinrs.Fields
strLine=strLine&x.value&chr(9)
next
--将表的数据写进EXCEL
myfile.writelinestrLine
rs.MoveNext
loop
endif
rs.Close
setrs=nothing
conn.close
setconn=nothing
setmyfile=nothing
Setfs=Nothing
link="<AHREF="&filename&">OpenTheExcelFile</a>"
Response.writelink
endif
%>
</BODY>
</HTML>
2、数据库相干:
CREATETABLE[populationperhour](
[population][int]NOTNULL,
[hourpos][int]NOTNULL,
[datepos][datetime]NOTNULL
);
insertintopopulationperhourvalues(936,1,2001-1-11);
insertintopopulationperhourvalues(636,2,2001-1-11);
insertintopopulationperhourvalues(106,3,2001-1-11);
insertintopopulationperhourvalues(177,4,2001-1-11);
insertintopopulationperhourvalues(140,5,2001-1-11);
insertintopopulationperhourvalues(114,6,2001-1-11);
insertintopopulationperhourvalues(94,7,2001-1-11);
insertintopopulationperhourvalues(49,8,2001-1-11);
insertintopopulationperhourvalues(88,9,2001-1-11);
insertintopopulationperhourvalues(215,10,2001-1-11);
insertintopopulationperhourvalues(370,11,2001-1-11);
insertintopopulationperhourvalues(550,12,2001-1-11);
insertintopopulationperhourvalues(629,13,2001-1-11);
insertintopopulationperhourvalues(756,14,2001-1-11);
insertintopopulationperhourvalues(833,15,2001-1-11);
insertintopopulationperhourvalues(923,16,2001-1-11);
insertintopopulationperhourvalues(980,17,2001-1-11);
insertintopopulationperhourvalues(957,18,2001-1-11);
insertintopopulationperhourvalues(812,19,2001-1-11);
insertintopopulationperhourvalues(952,20,2001-1-11);
insertintopopulationperhourvalues(1379,21,2001-1-11);
insertintopopulationperhourvalues(1516,22,2001-1-11);
insertintopopulationperhourvalues(1476,23,2001-1-11);
insertintopopulationperhourvalues(1291,24,2001-1-11);
insertintopopulationperhourvalues(1028,1,2001-1-12);
insertintopopulationperhourvalues(687,2,2001-1-12);
insertintopopulationperhourvalues(462,3,2001-1-12);
insertintopopulationperhourvalues(317,4,2001-1-12);
insertintopopulationperhourvalues(221,5,2001-1-12);
insertintopopulationperhourvalues(158,6,2001-1-12);
insertintopopulationperhourvalues(127,7,2001-1-12);
insertintopopulationperhourvalues(81,8,2001-1-12);
insertintopopulationperhourvalues(96,9,2001-1-12);
insertintopopulationperhourvalues(192,10,2001-1-12);
insertintopopulationperhourvalues(380,11,2001-1-12);
insertintopopulationperhourvalues(629,12,2001-1-12);
insertintopopulationperhourvalues(745,13,2001-1-12);
insertintopopulationperhourvalues(964,14,2001-1-12);
insertintopopulationperhourvalues(1012,15,2001-1-12);
insertintopopulationperhourvalues(1050,16,2001-1-12);
insertintopopulationperhourvalues(1135,17,2001-1-12);
insertintopopulationperhourvalues(1130,18,2001-1-12);
insertintopopulationperhourvalues(894,19,2001-1-12);
insertintopopulationperhourvalues(1026,20,2001-1-12);
insertintopopulationperhourvalues(1430,21,2001-1-12);
insertintopopulationperhourvalues(1777,22,2001-1-12);
insertintopopulationperhourvalues(1759,23,2001-1-12);
insertintopopulationperhourvalues(1697,24,2001-1-12);
问题是他们究竟是喜欢他们是使用软件时,速度快还是速度慢好.(当然在3秒以内).无论是他们输入资料时,查找资料时,分析资料时. |
|