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. ie不支持getElementsByClassName的解决办法

    目前可以这么解决,判断浏览器支不支持这个方法,如果支持就不管:如果不支持,就在document对象里加入getElementsByClassName这个方法,按兴趣的朋友可以了解下 if (navig ...

  2. 两个app 的合并

    我们需要把两个app 合并在一起,就是在原有项目基础上添加一个功能使用.如下有项目a和项目b: 一开始,我们把项目b独立成一个module,然后,作为一个库给项目a调用. 问题是,项目b 已有的app ...

  3. WPF在DLL中读取Resource的方法

    WPF是个用户控件,被WinForm调用.而WinForm是在一个DLL类库中被调用.试了很多方法,都无法将Resource中的图读进程序.用下面的方法总算实现了.   /根据图片的名称,从资源中找到 ...

  4. Cellular Automata编写历程

    2016.10.14:完成大致框架编写,控制台下实现 取点方式:南北半球对称取点;同一半球同一经度相邻点之间弧长相等;同一纬度相邻点之间弧长相等;不同纬度的圆周长度不等 地图设定为球形 2016.10 ...

  5. JDBC连接各种数据库的字符串,就是不好记

    JDBC连接各种数据库的字符串大同小异,在此总结一下,备忘. oracle    driverClass:oracle.jdbc.driver.OracleDriver    url:jdbc:ora ...

  6. ACM n-1位数

    n-1位数 时间限制:3000 ms  |  内存限制:65535 KB 难度:1   描述 已知w是一个大于10但不大于1000000的无符号整数,若w是n(n≥2)位的整数,则求出w的后n-1位的 ...

  7. vim安装插件

    1. 下载bundle mkdir ~/.vim/bundlegit clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle 2 ...

  8. C语言工具---Code::Blocks

    Code::Blocks Code::Blocks 是一个开源的全功能的跨平台C/C++集成开发环境. Code::Blocks是开放源码软件.由纯粹的C++语言开发完成,它使用了著名的图形界面库wx ...

  9. Linux下多进程编程之exec函数语法及使用实例

    exec函数族 1)exec函数族说明 fork()函数用于创建一个子进程,该子进程几乎复制了父进程的全部内容,但是,这个新创建的进程如何执行呢?exec函数族就提供了一个在进程中启动另一个程序执行的 ...

  10. Windows环境下的NodeJS+NPM+Bower安装配置步骤

    Windows下的NodeJS安装是比较方便的(v0.6.0版本之后,支持windows native),只需要登陆官网(http://nodejs.org/),便可以看到首页的“INSTALL”按钮 ...