国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 學(xué)院 > 開(kāi)發(fā)設(shè)計(jì) > 正文

關(guān)于客戶端用ASP參生報(bào)表

2019-11-18 20:30:49
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
先貼一篇較簡(jiǎn)單的用asp+RDS客戶端參生報(bào)表
此文希望能進(jìn)精華篇
下一回貼一篇較復(fù)雜的
說(shuō)明:(若提示ActiveX 元件無(wú)法參生 RDS.DataSpace)
IE需設(shè)置安全選項(xiàng)
操作:菜單工具->INTERNET選項(xiàng)->安全性->自定義
設(shè)置 起始但ActiveX不標(biāo)示為安全->開(kāi)啟
<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">

<div 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>
</div>

<form action="long.asp" 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">
</div>
<DIV id="adddata"></div>
</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","http://server name")
'the connection string to sql server to query database:pubs--->table:jobs
strCn="DRIVER={SQL Server};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")
xlSheet1.cells(cnt,3).value = rs("max_lvl")
xlSheet1.cells(cnt,4).value = rs("min_lvl")
rs.movenext
cnt = cint(cnt) + 1
loop
xlSheet1.Application.Visible = True

'adapt to office 2000 only
'xlSheet1.Range("A3").CopyFromRecordset rs
'xlSheet1.Application.Visible = True
end if
end sub
</script>

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 喀喇沁旗| 竹溪县| 乌拉特中旗| 庆安县| 原平市| 葫芦岛市| 洪江市| 濉溪县| 新龙县| 莱阳市| 青冈县| 郓城县| 洪江市| 邹平县| 永安市| 廊坊市| 恩平市| 静宁县| 吴旗县| 舟曲县| 洛南县| 玉门市| 无为县| 甘南县| 永年县| 大连市| 永仁县| 延吉市| 五寨县| 扎赉特旗| 琼海市| 长汀县| 成武县| 凤台县| 临沭县| 呼和浩特市| 城口县| 安仁县| 佛坪县| 昔阳县| 克拉玛依市|