test_print_report.asp
<html>
<head>
<meta content="text/html; charset=big5" http-equiv="content-type">
<title>client use rds produce excel report</title>
</head>
<body bgcolor="skyblue" topmargin=0 leftmargin="20" oncontextmenu="return false" rightmargin="0" bottommargin="0">
<form action="test_print_report.asp" method="post" name="myform">
<div align="center"><center>
<table border="5" bgcolor="#ffe4b5" style="height: 1px; top: 0px" bordercolor="#0000ff">
<tr>
<td align="middle" bgcolor="#ffffff" bordercolor="#000080">
<font color="#000080" size="3">
client use rds produce excel report
</font>
</td>
</tr>
</table>
</div>
<div align="left">
<input type="button" value="query data" name="query" language="vbscript" onclick="fun_query()" style="height: 32px; width: 90px">
<input type="button" value="clear data" name="clear" language="vbscript" onclick="fun_clear()" style="height: 32px; width: 90px">
<input type="button" value="excel report" name="report" language="vbscript" onclick="fun_excel()" style="height: 32px; width: 90px">
</div>
<div id="adddata"></div>
</form></center>
</body>
</html>
<script language="vbscript">
dim rds,rs,df
dim strsql,strrs,strcn,rowcnt
dim xlapp, xlbook, xlsheet1,xlmodule,xlpagesetup
dim headrowcnt,titlerowcnt,contentrowcnt,footrowcnt
dim pagerowcnt,pageno,totalpagecnt,contentrownowcnt
dim columnallwidth,columnawidth,columnbwidth,columncwidth,columndwidth
sub fun_query()
set rds = createobject("rds.dataspace")
set df = rds.createobject("rdsserver.datafactory","http://iscs00074")
strcn="driver={sql server};server=iscs00074;uid=sa;app=microsoft development environment;database=pubs;user id=sa;password=;"
strsql = "select * from jobs"
set rs = df.query(strcn, strsql)
if not rs.eof then
strrs="<table border=1><tr><td>job_id</td><td>job_desc</td><td>max_lvl</td><td>min_lvl</td></tr><tr><td>"+ rs.getstring(,,"</td><td>","</td></tr><tr><td>"," ") +"</td></tr></table>"
adddata.innerhtml=strrs
strrs=""
else
msgbox "no data in the table!"
end if
end sub
sub fun_clear()
strrs=""
adddata.innerhtml=strrs
end sub
sub fun_excel()
set rds = createobject("rds.dataspace")
set df = rds.createobject("rdsserver.datafactory","http://iscs00074")
strcn="driver={sql server};server=iscs00074;uid=sa;app=microsoft development environment;database=pubs;user id=sa;password=;"
strsql = "select count(*) as recordcnt from jobs"
set rs = df.query(strcn, strsql)
totalpagecnt=rs("recordcnt")
&n网站运营seo文章大全提供全面的站长运营经验及seo技术!