开发自己的SQL2005报表查看SharePoint WebPart(二)

开发者福利!热门AI工具限时免费用 购周边即赠Coding Plan Lite,Claude Code、Cursor等20+工具畅享,效率翻倍! 阅读详情

在(一)中,已经完成了一个sharepoint Web part的开发和部署。但是我们的web part还没有任何功能。现在,我们要开始将SQL reporting的报表显示功能加进来了。
访问SQL reporting报表有很多方法,这里我们选用的是调用Web service的方式。
在工程中增加对SQL reporting service的引用, http://ctc-bar:81/ReportServer/reportservice.asmx(ctc-bar:81是报表服务器名称和段口号)
为了简化对报表服务器的调用,我们新建一个ReportAdapter类负责对web service的调用。
using System;
using System.Collections.Generic;
using System.Text;

namespace BARreportWebPart
{
    public class ReportAdapter
    {
        ReportingServer.ReportingService ReportSvr = null;
        string reportServerURL = null;
        string reportPath = null;
        string format = "HTML4.0";
        string zoom = "100";
        string deviceInfo = "<DeviceInfo></DeviceInfo>";
        string encoding = null;
        string mimeType = null;
        ReportingServer.ParameterValue[] outParameters = null;
        ReportingServer.Warning[] warnings = null;
        string[] streamIDs = null;

        public ReportAdapter(string serverURL,string path)
        {
            reportServerURL = serverURL;
            reportPath = path;
            ReportSvr = new ReportingServer.ReportingService();
            ReportSvr.Url = reportServerURL;
            ReportSvr.Credentials = System.Net.CredentialCache.DefaultCredentials;
        }

        public ReportingServer.ReportParameter[] GetParameters()
        {
            return ReportSvr.GetReportParameters(reportPath, null, false, null, null);
        }

        public byte[] RenderReport(ReportingServer.ParameterValue[] parameterValues)
        {
            return ReportSvr.Render(reportPath, format, null, deviceInfo, parameterValues, null, null, out encoding, out mimeType, out outParameters, out warnings, out streamIDs);
        }
    }
}

这个类的构造函数用来指定要访问的报表serverURL是服务器的地址,path是报表的路径
GetParameters()可以返回报表的参数,我们可以自己构造参数输入的UI控件。
RenderReport用来返回查询报表的结果。

然后,我们在web part的render方法中调用ReportAdapter来查询报表
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;

namespace BARreportWebPart
{
    public class BARreportWebPart : WebPart
    {
        public BARreportWebPart()
        {
        }

        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            string reportServerURL = "http://ctc-bar:81/ReportServer/ReportService.asmx";
            string reportPath = "/BARreports/EBCdetailList";

            ReportAdapter rsAdapter = new ReportAdapter(reportServerURL, reportPath);
            ReportingServer.ReportParameter[] parameters = rsAdapter.GetParameters();
            ReportingServer.ParameterValue[] parameterValues = null;
            if (parameters.Length > 0)
            {
                parameterValues = new ReportingServer.ParameterValue[parameters.Length];
                for (int i = 0; i < parameters.Length; i++)
                {
                    parameterValues[i] = new ReportingServer.ParameterValue();
                    parameterValues[i].Name = parameters[i].Name;
                    parameterValues[i].Label = parameters[i].Prompt;
                }
                parameterValues[0].Value = "2007-1-1";
                parameterValues[1].Value = "2007-3-1";
            }
            System.Text.Encoding enc = System.Text.Encoding.UTF8;
            byte[] result = rsAdapter.RenderReport(parameterValues);
            string htmlResult = enc.GetString(result);
            //htmlResult = htmlResult.Replace(reportServerURL.Replace("/ReportService.asmx", "?"), "http://" & Request("SERVER_NAME") & Request("SCRIPT_NAME") & "?Report=");
            writer.Write(htmlResult);
        }
     }
}

 

 

TCS34725颜色识别模块实战调校:从“一坨”例程到精准RGB 本文针对TCS34725颜色识别模块初始数据不准的问题,提供了从基础例程到精准调校的实战指南。核心在于通过白光校正与黑白光校正两种方法,补偿传感器偏差与环境光影响,将原始数据准确映射为标准RGB值。文章详细阐述了校准原理、操作步骤与代码实现,并分享了进阶调试技巧与避坑指南,帮助开发者显著提升颜色识别的准确性与项目可靠性。 阅读详情

相关推荐

【ORB-SLAM3】使用安卓手机的摄像头运行ORB3

使用安卓手机的摄像头运行ORB-SLAM3单目

caiqidong321的博客 4957

开发自己的SQL2005报表查看SharePoint WebPart(一)

 SQL 2005自己提供的报表查看web part功能比较简单,不太适合中国人对报表界面的复杂要求。这个WebPart的主要功能是提供新的参数录入方式,如日期型改用日历来选择。第一步:建立一个新的web part新建一个的dll工程BARreportWebPart将class1.cs重命名为BARreportWebPart。增加对System.web的引用,并将类BARrep

闫炜的专栏 1974

IGBT基础知识

IGBT

u010783226的专栏 1万+

开发自己的SQL2005报表查看SharePoint WebPart

 开发自己的SQL2005报表查看SharePoint WebPart(一)SQL 2005自己提供的报表查看web part功能比较简单,不太适合中国人对报表界面的复杂要求。这个WebPart的主要功能是提供新的参数录入方式,如日期型改用日历来选择。第一步:建立一个新的web part新建一个的dll工程BARreportWebPart将class1.cs重命名为BARrep

neptunelove的专栏 785

开发自己的SQL2005报表查看SharePoint WebPart ()

SQL 2005自己提供的报表查看web part功能比较简单,不太适合中国人对报表界面的复杂要求。这个WebPart的主要功能是提供新的参数录入方式,如日期型改用日历来选择。第一步:建立一个新的web part新建一个的dll工程BARreportWebPart将class1.cs重命名为BARreportWebPart。增加对System.web的引用,并将类BARrepo

开发问题集锦 856

SharePoint中集成SQL reporting services

 安装SQL 2005 Reporting service1 我的SQL server 2005 reporting services和Sahrepoint Portal Server安装在同一台服务器时。在启动reporting services的过程中经历了很多周折。先用reporting service configuration manager设置reporting servi

闫炜的专栏 2209

SharePoint WebPart开发实战(一):定制属性及配置界面

        最近一段时间都在研究SharePoint下的开发,感觉SharePoint中的内容还是比较繁杂的,不知道自己入了门没有?顺手记录下了开发过程中的一些心得和体会,以加深自己的理解和掌握,如有不对的地方,还请各位不吝指正。今天先讲讲SharePoint下Web Part的开发,这应该算是SharePoint下最常见的开发了吧,今天的重点是关于自定义属性及配置界面的实现。一、开发环境

程序人生 7072

SharePoint 集成SqlServer2005报表

1、制作报表的过程很简单,在VS2005中创建项目,选择报表服务(安装SqlServer2005后才有这个项目)2、安装SQL 2005的web part,文件地址为C:/Program Files/Microsoft SQL Server/90/Tools/Reporting Services/SharePoint下面,可以找到安装文件RSWebParts.cab。使用命令行安装web part

Li Minghua的专栏 900

开发自己的SQL2005报表查看SharePoint WebPart(四)

  这一节,我们给Web part增加报表查询参数。为了演示,这里只增加两个查询参数:开始时间和结束时间。这两个参数都是日期型的数据,为了方便用户操作,我使用了client端的日历脚本来实现日期输入。与上一节相比,我们需要增加两部分工作第一步:构造日期输入控件我的页面布局大概是这样的:

闫炜的专栏 1616

Sharepoint网站中使用SqlServer的ReportService报表简介

一,准备ReportService报表 1建立含查询参数的存储过程 2.打开你的报表管理器,假设你的Report Service发布在soungcha:8085上,则在IE中输入http://soungcha:8085/reports,会看到报表管理器界面, 新建一个文件夹,如wfreport,用于存放报表,可以此时设置它的权限,例如让internet\zhangsan拥有brows...

digang3207的博客 273

开发自己的SQL2005报表查看SharePoint WebPart(三)

我们在(一)里完成了web part的实现在()里完成了通过调用SQL2005 reporting services的web service,查询并显示报表现在,我们要给Web part增加属性来设置报表服务器的地址和报表路径首先,为了能够在SharePoint中设置属性,需要增加对Microsoft.SharePoint的引用,原来我们的BARreportWebPart是从System.Web

闫炜的专栏 1606

Sharepoint网站中使用SqlServer的ReportService报表简介在Sharepoint网站中使用SqlServer的ReportService报表简介

<br />一,准备ReportService报表<br />1建立含查询参数的存储过程<br />2.打开你的报表管理器,假设你的Report Service发布在soungcha:8085上,则在IE中输入http://soungcha:8085/reports ,会看到报表管理器界面, 新建一个文件夹,如wfreport,用于存放报表,可以此时设置它的权限,例如让internet/zhangsan拥有browser权限<br />3.打开VS2005,新建报表项目,<br /> a.新建共享数据源

狂野之城 1253

What you need to do to using the SharePoint add-in for SQL2005

What you need to do to using the SharePoint add-in for SQL2005: Install ref 1 Install SQL 2005 and reporting service, then patch the sp2 for SQL 2005. Install WSS 3.0 or MOSS 200...

AAA2225596的博客 192

SharePoint 2007图文开发教程【图片更新中】

SharePoint 2007图文开发教程(1)---简介,安装,配置及创建Web应用程序 简介    Microsoft Office SharePoint Server 2007 是一个服务器功能集成套件,它提供全面的内容管理和企业搜索、加速共享业务流程并便利跨界限信息共享以更好地了解业务,从而有助于提高组织的工作效率。 Office SharePoint Server 2007

follow excellence 1730

关于SharePoint部署Webpart的十个必读链接(downmoon)

关于SharePoint部署Webpart的十个必读链接(downmoon) ,一家之言, 呵呵!1、如何编写用于 SharePoint Portal Server 2003 的备份和恢复应用程序http://www.microsoft.com/china/MSDN/library/Office/sharepoint/SharePointBackupRestore.mspx2、面向开发人员的

邀月周记 3349

webpart中访问SQL 2005 Express数据库问题的处理办法

我的WEBPart代码如下:1、WebCustomControl1.cs文件:using System;using System.Collections.Generic;using System.ComponentModel;using System.Text;using System.Web;using System.Web.UI;using System.Web.UI.WebCon

eNet 2710

SharePoint中调试WebPart,用VS2008

在MOSS 2007中调试WebPart是件很容易的事件,具体步骤如下:        1、设置WebPart项目生成输出路径        将要调试的WebPart项目生成输出路径设置为该WebPart将要部署到的调试站点bin目录,通过项目“属性->生成->输出->输出路径”进行设置即可,如下图所示:                 2、附加WSS进程        附加w3wp.exe进程。

yqandxyz的专栏 1856

如何在Sharepoint调试webpart

在MOSS 2007中调试WebPart是件很容易的事件,具体步骤如下: 1、设置WebPart项目生成输出路径 将要调试的WebPart项目生成输出路径设置为该WebPart将要部署到的调试站点bin目录,通过项目“属性->生成->输出->输出路径”进行设置即可,如下图所示: 2、附加WSS进程 附加w3wp.exe进程。在附加进程窗口中,名称为w3wp.exe的进程可能有2...

weixin_34238642的博客 151
上一篇: 开发自己的SQL2005报表查看SharePoint WebPart(一)
下一篇: 开发自己的SQL2005报表查看SharePoint WebPart(三)
yanwei100
博客等级 码龄24年 9粉丝 71原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值