zoukankan      html  css  js  c++  java
  • Reporting Services系列五:WebService接口

    ReportingServices提供WebService接口,基本上所有报表的操作都可以利用它们完成,以下在代码演示如何使用它们进行报表的导出、报表的订阅等。其中报表订阅中的邮件订阅未经过实际测试,其它代码都经过测试,没有发现什么问题。当然方法只是给出个原理,没有什么真正实用价值,有兴趣的人可以根据自己的需求对接口进行包装。

    在动手写代码之前,你要添加对此WebService的引用,如图:

    //

    代码如下:

    测试代码:


            
    private void btExp_Click(object sender, System.EventArgs e)
            
    {
                RsWebServiceHelper h
    =new RsWebServiceHelper();
                
    string[][] pv=new string[4][];
                pv[
    0]=new string[2]{"start_time","2007-02-01"};
                pv[
    1]=new string[2]{"end_time","2007-03-01"};
                pv[
    2]=new string[2]{"note","20"};
                pv[
    3]=new string[2]{"RsName","Alarm"};
                
    bool rt=h.ExportReport("/pReports/AlarmLevel",pv,"Excel",@"e:\myhuang\rs.xls");
                
    if(rt)
                
    {
                    Response.Write(
    "<script language=javascript>window.alert('ok');</script>");
                }

                
    else
                
    {
                    Response.Write(
    "<script language=javascript>window.alert('failed');</script>");
                }

            }


            
    private void btSubs_Click(object sender, System.EventArgs e)
            
    {
                
    string[][] pv=new string[4][];
                pv[
    0]=new string[2]{"start_time","2007-02-01"};
                pv[
    1]=new string[2]{"end_time","2007-03-01"};
                pv[
    2]=new string[2]{"note","20"};
                pv[
    3]=new string[2]{"RsName","Alarm"};

                RsWebServiceHelper h
    =new RsWebServiceHelper();
                
    string rtout;
                
    bool rt=h.SubscriptionFileShare("/pReports/AlarmLevel",pv,DateTime.Now.AddMinutes(1),"subsnew",@"e:\myhuang\RsShareFolder","EXCEL","myhuang","123",out rtout);
                
    if(rt)
                
    {
                    Response.Write(
    "<script language=javascript>window.alert('succeed:"+rtout+"');</script>");
                }

                
    else
                
    {
                    Response.Write(
    "<script language=javascript>window.alert('error:"+rtout+"');</script>");
                }

            }

  • 相关阅读:
    这么香的Chrome插件,你都安装了吗?
    Android frameworks源码StateMachine使用举例及源码解析
    数据结构与算法系列七(队列)
    openoffice下中文乱码问题解决
    linux yum命令详解
    linux下Redis的安装
    ason 和 Java 对象转化示例
    java将office文档pdf文档转换成swf文件在线预览
    MyBatis SQL xml处理小于号与大于号
    Fisher 线性判别
  • 原文地址:https://www.cnblogs.com/morvenhuang/p/839548.html
Copyright © 2011-2022 走看看