RDLC Reporting in Visual Studio 2017
原文:RDLC Reporting in Visual Studio 2017
Visual Studio 2017 中可以使用 RDLC Reporting 插件来设计报表,SAP Crystal Report(水晶报表)的用法与之类似。
步骤一、在 VS 中打开 “工具” 菜单下的 “扩展与更新” 选项,搜索 RDLC Reporting,并安装:
- Microsoft Rdlc Report Designer for Visual Studio
- Rdlc Designer and projects for ASP.Net and Windows Forms for Reporting Services Report Viewer Control
- Microsoft Reporting Services Projects
- The Microsoft RDL report designer, projects and wizards for creating professional reports.

安装成功后,新建 WinForm 项目,并添加新项,就可以看到 “报表” 选项了。

步骤二、添加相关的 NuGet 包:Microsoft.ReportingServices.ReportViewerControl.Winforms

步骤三、为项目添加新项,选择 “报表” 并命名为 Report1.rdlc,然后打开 Report1.rdlc 并添加数据集。

步骤四、打开一个窗体,并在工具箱里的 Microsoft SQL Server 选项下选择 ReportViewer 控件,添加到 Form2 中。并设置其报表模板。

步骤五、在窗体的加载事件中添加具体的数据绑定逻辑
private void Form2_Load(object sender, EventArgs e)
{
reportViewer1.LocalReport.ReportEmbeddedResource = "WindowsFormsApp1.Report1.rdlc"; // 包含命名空间和报表文件名称 DataTable studentDt = new DataTable("DAS_Staff"); studentDt.Columns.Add("StaffID");
studentDt.Columns.Add("StaffFirstName");
studentDt.Columns.Add("StaffLastName"); studentDt.Rows.Add("", "Jack", "tt");
studentDt.Rows.Add("", "Lucy", "tt");
studentDt.Rows.Add("", "Jason", "tt");
studentDt.Rows.Add("", "Lili", "tt"); reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", studentDt)); //注:这里数据源名称要与上面再报表模板中定义的数据源名称一致。 reportViewer1.RefreshReport(); this.reportViewer1.RefreshReport();
}
最后,运行程序显示效果如下:

参考资料:
http://shashangka.com/2017/05/17/enable-rdlc-reporting-in-visual-studio-2017
https://www.cnblogs.com/dreamos/p/7599253.html
RDLC Reporting in Visual Studio 2017的更多相关文章
- Visual Studio 2017十五项新功能体验
Visual Studio 2017正式已经于2017.3.7号正式发布,选在这一天发布也是为了纪念Visual Studio 二十周年.MVP 2017技术峰会将于这个周末(3.17)在北京举办,由 ...
- 深入研究Visual studio 2017 RC新特性
在[Xamarin+Prism开发详解三:Visual studio 2017 RC初体验]中分享了Visual studio 2017RC的大致情况,同时也发现大家对新的Visual Studio很 ...
- Xamarin+Prism开发详解三:Visual studio 2017 RC初体验
Visual studio 2017 RC出来一段时间了,最近有时间就想安装试试,随带分享一下安装使用体验. 1,卸载visual studio 2015 虽然可以同时安装visual studio ...
- Microsoft Visual Studio 2017 for Mac Preview 下载+安装+案例Demo
目录: 0. 前言 1. 在线安装器 2. 安装VS 3. HelloWorld 4. ASP.NET MVC 5. 软件下载 6. 结尾 0. 前言: 工作原因,上下班背着我的雷神,一个月瘦了10斤 ...
- Create an offline installation of Visual Studio 2017 RC
Create an offline installation of Visual Studio 2017 RC 2016年12月7日 ...
- Visual Studio 2017 RC 初探安装
上次看到博客介绍 Visual Studio 2017 RC,看到其中一个改进是启动很快,这是一大进步,也是低配电脑的程序员的期望.不过还没体验,是驴是骡子拉出来看看,这不就开始下载. 1.打开官网: ...
- .NET十五周年生日快乐 (3月7日发布Visual Studio 2017正式版?)
今天 是.NET 对世界首次亮相15 周年.2002 年 2 月 13 日,第一版本的.NET 发布作为 Visual Studio.NET 的一部分.它仿佛就在昨天为微软建设成"下一代 W ...
- Visual Studio 2017 离线安装方式
Visual Studio, 特别是Visual Studio 2017 通常是一个在线安装程序,如果你在安装过程中失去连接,你可以遇到问题.但是,由于法律原因,微软没有提供完整的可下载的ISO镜像. ...
- 最强 IDE Visual Studio 2017 正式版发布
Visual Studio 2017 正式版发布,该版本不仅添加了实时单元测试.实时架构依赖关系验证等新特性,还对许多实用功能进行了改进,如代码导航.IntelliSense.重构.代码修复和调试等等 ...
随机推荐
- jQuery获取url
JS获取当前页面的URL信息 设置或获取对象指定的文件名或路径. <script> alert(window.location.pathname) </script> 设置或获 ...
- Java并发(五):并发,迭代器和容器
在随后的博文中我会继续分析并发包源码,在这里,得分别谈谈容器类和迭代器及其源码,虽然很突兀,但我认为这对于学习Java并发很重要; ConcurrentModificationException: J ...
- koa源码分析
最近项目要使用koa,所以提前学习一下,顺便看了koa框架的源码. 注:源码是koa2.x koa的源码很简洁,关键代码只有4个文件,当然还包括一些依赖npm包 const Koa = require ...
- Android仿微信高效压缩图片(libjpeg)
用过ios手机的同学应该很明显感觉到,ios拍照1M的图片要比安卓拍照排出来的5M的图片还要清晰.这是为什么呢? 这得了解android底层是如何对图片进行处理的. 当时谷歌开发Android的时候, ...
- 【Java/Android性能优 7】Android公共库——图片缓存 网络缓存 下拉及底部更多ListView 公共类
本文转自:http://www.trinea.cn/android/android-common-lib/ 介绍总结的一些android公共库,包含缓存(图片缓存.预取缓存.网络缓存).公共View( ...
- A011 Activiti工作流程开发的一些统一规则和实现原理(完整版)
注意:以下规则是我为了规范流程的处理过程,不是Activiti公司的官方规定. 1.流程启动需要设置启动者,在Demo程序中,“启动者变量”名统一设置为initUserId 启动时要做的: ident ...
- hiho一下 第三十九周 归并排序求逆序数
题目链接:http://hihocoder.com/contest/hiho39/problem/1 ,归并排序求逆序数. 其实这道题也是可以用树状数组来做的,不过数据都比较大,所以要离散化预处理一下 ...
- Linux命令技巧:如何在Linux下重命名多个文件
我知道我可以用mv命令重命名文件.但是当我想重命名很多文件怎么办?如果为每个文件都这么做将会是很乏味的.有没有办法一次性重命名多个文件? 在Linux中,当你想要改变一个文件名,使用mv命令就好了.然 ...
- hdu-1198 Farm Irrigation---并查集+模拟(附测试数据)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1198 题目大意: 有如上图11种土地块,块中的绿色线条为土地块中修好的水渠,现在一片土地由上述的各种 ...
- Memory Usage Performance Guidelines
https://developer.apple.com/library/content/documentation/Performance/Conceptual/ManagingMemory/Arti ...