|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
asp对于服务器的要求较高,一般的服务器如果访问量一大就垮了,不得不重启。server|数据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);
insertintopo</p>我想详细了解ASP整站代码与PSP整站代码有什么优缺点,那个更好,更安全,更用容易维护,和管理。。。 |
|