WPF做Windows程序界面很好很强大,RDLC做报表免费又好用,如何将两者强强联合呢?
 
方法1:
   可以直接在WPF项目中加入一个WinForm窗体,在这个窗体上进行报表操作,与一般的WinForm编程没有什么区别。用WindowFormHost控件,直接集成报表到WPF窗体中,可以保持程序风格的一致性。
方法2:

A、引用ReportViewer的命名空间

<UserControl x:Class="CMRESTPORTAL.Reports"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   xmlns:wf="clr-namespace:Microsoft.Reporting.WinForms;assembly=Microsoft.ReportViewer.WinForms"   //很关键的一句哦
    Height="Auto" Width="Auto">
    </UserControl>

B、添加WindowsFormsHost控件

<Grid>
       < WindowsFormsHost Name="ReportsHost">

< wf:ReportViewer Name="BuildReport">
               
           < /wf:ReportViewer>
       < /WindowsFormsHost>

</Grid>

C、添加相关代码,显示报表

public Reports()
        {
            InitializeComponent();

Microsoft.Reporting.WinForms.ReportViewer rep = ReportsHost.Child as Microsoft.Reporting.WinForms.ReportViewer;
            rep.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote; //远程模式
            Uri uri = new Uri("http:/reportserver");  //report所在的report server
            rep.ServerReport.ReportServerUrl = uri; 
            rep.ServerReport.ReportPath = "/ReportFolder/BuildReportForQuery";     //report所在的路径
            rep.RefreshReport();  //Calling the RefreshReport method causes all data in the report to be reloaded and rendered.

}

reporting service & wpf的更多相关文章

  1. SQL Server性能计数器收集汇总方案(Reporting Service)

    通过收集计数器信息,并将计数器信息汇总为不同粒度存储,以Reporting Service报表服务器显示.以下是计数器收集汇总的基本架构. 笔者需要收集的SQL Server计数器包括:SQL Ser ...

  2. Reporting Service 服务启动时报错The service did not respond to the start or control request in a timely fashion

    案例环境: 启动一台数据库服务器(Windows Server 2003)的Reporting Service(SQL Server 2008 R2)服务时,出现如下错误信息: System.Inva ...

  3. 数据库服务器改名导致Reporting Service不可用的案例

    案例环境: 操作系统版本    :    Windows Server 2012 R2 Standard 数据库版本      :   SQL Server 2012 Standard Edition ...

  4. Reporting Service 告警"w WARN: Thread pool pressure. Using current thread for a work item"

    如果Reporting Service偶尔出现不可访问或访问出错情况,这种情况一般没有做监控的话,很难捕捉到.出现这种问题,最好检查Reporting Service的日志文件. 今天早上就遇到这样一 ...

  5. SQL Server Reporting Service(SSRS) 第二篇 SSRS数据分组Parent Group

    SQL Server Reporting Service(SSRS) 第一篇 我的第一个SSRS例子默认使用Table进行简单的数据显示,有时为了进行更加直观的数据显示,我们需要按照某个字段对列表进行 ...

  6. SQL Server Reporting Service(SSRS) 第一篇 我的第一个SSRS例子

    很早就知道SQL SERVER自带的报表工具SSRS,但一直没有用过,最近终于需要在工作中一展身手了,于是我特地按照自己的理解做了以下总结: 1. 安装软件结构 SSRS全称SQL Server Re ...

  7. Reporting Service 配置SMTP和设置订阅出现的异常

    SSRS能够按照schedule,以mail的形式发送report,这是通过设置subscription report来实现的. 1,发送mail需要在SSRS中配置SMTP Server,如果没有R ...

  8. Reporting Service 没有权限登陆

    在配置好Reporting Service之后,登陆Report Mananger( http://localhost/Reports/Pages/Folder.aspx)出现一个异常,本地用户没有权 ...

  9. 【解决】SharePoint集成模式下Reporting Service—为用户授予的权限不足,无法执行此操作。 (rsAccessDenied)

    环境:Windows Server 2008 R2 SP1,SharePoint 2010 企业版,SQL Server 2008 R2 Reporting Service(SharePoint集成模 ...

随机推荐

  1. ural 1255. Graveyard of the Cosa Nostra

    1255. Graveyard of the Cosa Nostra Time limit: 1.0 secondMemory limit: 64 MB There is a custom among ...

  2. iOS之04-方法的声明和实现

    本次重点学习和理解OC对象方法的声明和定义 代码: /* 计算器类 方法: 1> 返回 π 2> 计算某个整数的平方 3> 计算两个整数的和 */ #import <Found ...

  3. [转]linux下svn命令大全

    FROM:http://www.jb51.net/os/RedHat/2461.html 1.将文件checkout到本地目录 svn checkout path(path是服务器上的目录) 例如:s ...

  4. 种树 & 乱搞

    题意: 在一个(n+1)*(m+1)的网格点上种k棵树,树必须成一条直线,相邻两棵树距离不少于D,求方案数. SOL: 这题吧...巨坑无比,本来我的思路是枚举每一个从(0,0)到(i,j)的矩形,然 ...

  5. hdu 2160 母猪的故事

    Problem Description 话说现在猪肉价格这么贵,著名的ACBoy 0068 也开始了养猪生活.说来也奇怪,他养的猪一出生第二天开始就能每天中午生一只小猪,而且生下来的竟然都是母猪.不过 ...

  6. Issues I encountered when building Windows Store apps on a new laptop

    I took over my beloved wives samsung ativ book 9 recently as her first job granted her a brandnew su ...

  7. 【BZOJ2821】作诗(Poetize) 分块

    Description 神犇SJY虐完HEOI之后给傻×LYD出了一题:SHY是T国的公主,平时的一大爱好是作诗.由于时间紧迫,SHY作完诗之后还要虐OI,于是SHY找来一篇长度为N的文章,阅读M次, ...

  8. 【BZOJ2818】Gcd 欧拉筛

    Description 给定整数N,求1<=x,y<=N且Gcd(x,y)为素数的数对(x,y)有多少对. Input 一个整数N Output 如题 Sample Input 4 Sam ...

  9. 无法将Win7安装到GPT分区下解决办法

    当出现"您想将windows安装 在何处时",按shift+F10打开命令提示符,输入:diskpartlist disksel disk 0cleanconvert mbr完成转 ...

  10. Spring MVC和Struts2的比较(二)

    1.Spring MVC的controller+command object模式比Struts2的Action模式更安全一些.而在Struts2中,自动数据绑定发生在Action对象上.这样,在Act ...