优秀的软件开发团队:深圳升蓝软件 数据库开发 .Net技术  |  ASP技术 PHP技术 JSP技术 应用技术类     
热门推荐
升蓝OA办公自动化系统
基于.Net技术的网络
协同办公环境
 
ASP基础
数据库相关
安全加密
全文检索
ASP应用
打印相关
客户端相关
XML相关
系统相关
正则表达式
ASP技巧
组件开发
脚本编码
FSO专题
邮件相关
远程脚本
性能优化
 
相关链接
深圳升蓝软件:系统集成、办公自动化平台、电子商务、电子政务、Web数据库、企业网站、游戏、手机应用程序、CDMA软件、电子出版物等,为客户提供优秀的解决方案
 
升蓝(www.hi-blue.com)为企业管理、政府办公提供成熟的、易于实施的IT技术服务,我们的解决方案包括OA办公自动化系统CRM客户关系管理系统ERP企业生产管理和订单管理系统电子政务系统、知识管理系统、企业门户、商业智能、工程项目管理等等...
 
电子政务解决方案
塑料/橡胶管理系统
知识管理系统简介
多媒体光盘方案
ERP企业资源管理
订单计划管理系统
PM工程项目管理系统
会员管理系统
相关资料下载
OA办公自动化系统
CRM客户关系管理系统
在线试用版本说明
OA 系统的用户手册
 
 
 
 
升蓝开发团队 > 技术资料 > ASP技术 > 打印相关 : 关于客户端用ASP参生报表

关于客户端用ASP参生报表


March 25,2004
先贴一篇较简单的用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">

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

       
数据库开发 | .Net技术 | ASP技术 | PHP技术 | JSP技术 | 应用技术类 | 升蓝开发小组
Copyright ? 2001-2004 Shenzhen Hi-blue Software Team 升蓝开发小组 All rights reserved