C#winform初试报表
步骤1.新建一个窗口,拖一个ReportViewer控件上去,设置该控件的Dock为Fill。
步骤2.添加一个报表文件,如:Report1.rdlc,设置其中的参数,这里设置的参数和下面的代码里面的参数是对应的。
//加载报表文件,Debug目录下
this.reportViewer1.LocalReport.ReportPath = "Report1.rdlc"; this.reportViewer1.ProcessingMode = ProcessingMode.Local;
reportViewer1.LocalReport.DataSources.Clear();
DataTable dt = new DataTable();
DataColumn col1 = new DataColumn("姓名", System.Type.GetType("System.String"));
DataColumn col2 = new DataColumn("学号", System.Type.GetType("System.String"));
DataColumn col3 = new DataColumn("性别", System.Type.GetType("System.String"));
DataColumn col4 = new DataColumn("年龄", System.Type.GetType("System.Int32"));
dt.Columns.Add(col1);
dt.Columns.Add(col2);
dt.Columns.Add(col3);
dt.Columns.Add(col4);
DataRow row1 = dt.NewRow();
row1["姓名"] = "张三";
row1["学号"] = "";
row1["性别"] = "男";
row1["年龄"] = ;
dt.Rows.Add(row1);
//静态数据不用加数据源
//ReportDataSource rds1 = new ReportDataSource("DataSet1", dt);
//reportViewer1.LocalReport.DataSources.Add(rds1);
ReportParameter ReportParameter_XM = new ReportParameter("ReportParameter_XM", dt.Rows[]["姓名"].ToString());
ReportParameter ReportParameter_XH = new ReportParameter("ReportParameter_XH", dt.Rows[]["学号"].ToString());
ReportParameter ReportParameter_XB = new ReportParameter("ReportParameter_XB", dt.Rows[]["性别"].ToString());
ReportParameter ReportParameter_NL = new ReportParameter("ReportParameter_NL", dt.Rows[]["年龄"].ToString());
reportViewer1.LocalReport.SetParameters(new ReportParameter[] { ReportParameter_XM, ReportParameter_XH, ReportParameter_XB, ReportParameter_NL });
reportViewer1.RefreshReport();
C#winform初试报表的更多相关文章
- WinForm 水晶报表的简单使用
今天需要做出一个水晶报表, 以前在学校的时候就看过一点点,有些印象, 但没有具体的了解过,今天百度了一下,发现这个东西相当的方便简单. 还很完美. 开发工具是VS2010,水晶报表没有内置.需要自己下 ...
- winform 子报表
public void BindReport(string _invno,string _type) { if (!Is_Has_Express_No(_inv ...
- C# WinForm RDLC报表不预览直接连续打印
用微软的RDLC报表直接打印不预览 直接上代码. //打印清单 System.Data.DataTable dt = print_QD(dr); ReportViewer rvDoc = new Re ...
- winform,水晶报表制作
1.安装最新的 SP:(SP 29 示例 – https://origin.softwaredownloads.sap.com/public/file/0020000001636412020) 2.新 ...
- 如何隐藏winform中报表设计器中的按钮
https://www.devexpress.com/Support/Center/Question/Details/T246117 DesignMdiController.SetCommandVis ...
- winform 子报表数据源赋值
this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource(&qu ...
- WinForm 图形报表控件
http://wenku.baidu.com/link?url=hOCeHErshNOw6NScDG3Y6JjT1mD-A4xHhjthcHyrTgk5NmPRKf0eqeaee4LmKZX5jd7S ...
- winform水晶报表编译错误,未能加载文件或程序集"file:///C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framewor "
未能加载文件或程序集“file:///C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Commo ...
- winform中使用ReportViewer的时候,找不到报表数据面板.
最近在做winform的报表项目,看人家教程里都有报表数据面板,可我的怎么都找不到,我的是VS2012,最后终于找到,首先必须在报表设计TAB上(选中它),然后选择视图->报表数据
随机推荐
- dedecms v5.7 sp1 给栏目添加缩略图功能
一.给数据库添加字段typeimg 如图: 二 . 修改 dede/catalog_add.php 找到 $in_query = "INSERT INTO `#@__arctype`(r ...
- 常用命令之ps
ps : process status ps 为我们提供了进程的一次性的查看,它所提供的查看结果并不动态连续的:如果想对进程时间监控,应该用 top 工具. kill 命令用于杀死进程. linux上 ...
- Plan9 与 Plan9port
Plan9 Plan9 是一个操作系统.由贝尔实验室开发的,其主要的负责人是Rob Pike(现在在google工作,负责Go语言的开发). 参考:http://www.cnblogs.com/yjf ...
- 采用p6spy完整显示hibernate的SQL语句
虽然在hibernate中有show_sql选项,但是显示出来的语句大多类似 select * from xxx where value=? 但是有时候我们需要得到完整的SQL语句,怎么办呢?使用P6 ...
- ansible管理
查看版本: ansible –version 升级pip安装的ansible: sudo pip install -U ansible
- Collections.emptyList() and Collections.EMPTY_LIST
返回的emptyList不支持add()
- WebsitePanel(wsp)配置详解(安装指南)
WebsitePanel(wsp)配置详解(安装指南) 铁卫士原创 估计很多同学都还不知道WebsitePanel是什么东东吧,WebsitePanel简称wsp是微软旗下,开源免费的虚拟主机系统,我 ...
- VC++2005下的ADO SQL语句(like,count,distinct)和操作(转)
http://blog.sina.com.cn/s/blog_56fd66a70100hxjf.html http://timke.blog.163.com/blog/#m=0 环境:MFC Dia ...
- 关于scrollview监听的一些方法
一 package cn.testscrollview; import android.os.Bundle; import android.view.MotionEvent; import andro ...
- 利用canvas实现的中点Bresenham算法
Bresenham提出的直线生成算法的基本原理是,每次在最大位移方向上走一步,而另一个方向是走步还是不走步取决于误差项的判别,具体的实现过程大家可以去问度娘.我主要是利用canvas画布技术实现了这个 ...