当前位置: 移动技术网 > IT编程>开发语言>.net > 关于客户端用ASP参生报表

关于客户端用ASP参生报表

2018年10月14日  | 移动技术网IT编程  | 我要评论

重庆13岁男孩,赵伦熙,郭美美qvod

先贴一篇较简单的用asp+rds客户端参生报表
此文希望能进精华篇
下一回贴一篇较复杂的
说明:(若提示activex 元件无法参生 rds.dataspace)
ie需设置安全选项
操作:菜单工具->internet选项->安全性->自定义
设置 起始但activex不标示为安全->开启
<html>
<head>
<meta content="text/html; charset=gb2312" http-equiv=content-type>
<title>client use rds produce excel report</title>
<link rel="stylesheet" href="cdutmenu/common.css">
</head>
<body bgcolor=skyblue topmargin=5 leftmargin="20" oncontextmenu="return false" rightmargin=0 bottommargin="0">

<p align="center"><center>
<table border="1" 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>
</p>

<form action="long." method="post" name="myform">
<div align=left>
<input type="button" value="query data" name="query" language="vbscript" onclick="fun_excel(1)" style="height: 32px; width: 90px">
<input type="button" value="clear data" name="clear" language="vbscript" onclick="fun_excel(2)" style="height: 32px; width: 90px">
<input type="button" value="excel report" name="report" language="vbscript" onclick="fun_excel(3)" style="height: 32px; width: 90px">
</p>
<div id="adddata"></p>
</form>
</body>
</html>

<script language="vbscript">
sub fun_excel(t)
dim rds,rs,df
dim strcn,strsql,strrs
dim xlapp, xlbook, xlsheet1

use rds to produce client recordset
set rds = createobject("rds.dataspace")
set df = rds.createobject("rdsserver.datafactory","https://server name")
the connection string to sql server(windows平台上强大的平台) to query database:pubs--->table:jobs
strcn="driver={sql server(windows平台上强大的数据库平台)};server=server name;uid=sa;app=microsoft development environment;database=pubs;user id=sa;password=;"
the query string of sql
strsql = "select top 8 * from jobs order by job_id"
the recordset
set rs = df.query(strcn, strsql)

if t=1 then
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
elseif t=2 then
strrs=""
adddata.innerhtml=strrs
elseif t=3 then
set xlapp = createobject("excel.application")
set xlbook = xlapp.workbooks.add
set xlsheet1 = xlbook.worksheets(1)
xlsheet1.cells(1,1).value ="the job table "
xlsheet1.range("a1:d1").merge
xlsheet1.cells(2,1).value = "job_id"
xlsheet1.cells(2,2).value = "job_desc"
xlsheet1.cells(2,3).value = "max_lvl"
xlsheet1.cells(2,4).value = "min_lvl"
cnt = 3
adapt to office 97 and 2000
do while not rs.eof
xlsheet1.cells(cnt,1).value = rs("job_id")
xlsheet1.cells(cnt,2).value = rs("job_desc")

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网