在公司开发,使用到ReportView技术,写下自己的经验。

1.在工具箱中找到 ReportViewer,ScriptManager放到test.aspx页面。

如果找不到报表项,请参考http://www.cnblogs.com/worf/p/5714455.html

2.添加数据集 DataSet.xsd

在数据集中添加DataTable,添加查询的列,列名要和数据库中的列(字段)对应。

3.添加报表Report.rdlc

4.绑定数据

在这里绑定数据使用的是动态绑定。

  private void getDateBind()
{
//获得路径
string req_url = this.Request.Url.ToString();
string currentPath = "";
int pos = req_url.LastIndexOf("/");
if (pos > )
{
currentPath = req_url.Substring(, pos + );//给报表文本框添加url
}
DataSet ds = BuildingDetails.GetIndustryHYData(time1, time2, buildingId, industryId);//从数据库中查询的数据
totalCount.InnerText = ds.Tables[].Rows.Count.ToString();
rvBuildingDetail_IndustryHY.LocalReport.DataSources.Clear();
rvBuildingDetail_IndustryHY.LocalReport.DataSources.Add(new ReportDataSource("BuildingDetail_IndustryHY", ds.Tables[]));
rvBuildingDetail_IndustryHY.AsyncRendering = true;
rvBuildingDetail_IndustryHY.InteractivityPostBackMode = InteractivityPostBackMode.AlwaysSynchronous;
rvBuildingDetail_IndustryHY.ShowToolBar= true;//获取或设置一个指示工具栏在控件上是否可见的值。默认为true
rvBuildingDetail_IndustryHY.LocalReport.EnableHyperlinks = true;//指示在报表包含超链接操作时是否可以呈现
rvBuildingDetail_IndustryHY.HyperlinkTarget = "_self";//在相同的框架中打开被链接文档
rvBuildingDetail_IndustryHY.LocalReport.ReportPath = @"BuildingDetail\rdlc\BuildingDetail_IndustryHY.rdlc";//获取或设置本地报表的本地文件系统路径
rvBuildingDetail_IndustryHY.LocalReport.ReportEmbeddedResource = "BuildingDetail_IndustryHY.rdlc";//获取或设置报表嵌入资源的名称 //设置参数
ReportParameter rpCurrentPath = new ReportParameter("url", currentPath);
ReportParameter rpTime1 = new ReportParameter("time1", time1);
ReportParameter rpTime2 = new ReportParameter("time2", time2);
ReportParameter rpIndustryId = new ReportParameter("industryId", industryId);
ReportParameter rpBuildingId = new ReportParameter("buildingId", buildingId);
rvBuildingDetail_IndustryHY.LocalReport.SetParameters(new ReportParameter[] { rpCurrentPath, rpCurrentPath, rpTime1, rpTime2, rpIndustryId, rpBuildingId });
}
到此,整个流程完成。

ReportView报表开发记录(一)的更多相关文章

  1. Grid++Report 报表开发工具

      Grid++Report 报表开发工具   版本 更新日期 大小 下载 说明 Grid++Repoert6.0.0.6 2015/08/08 16.0M [下载] 锐浪报表工具最新版本,新增功能说 ...

  2. JasperReport报表开发(一)--原理介绍

    1. JasperReport介绍 JasperReport 是一个开源的Java报表引擎,它不像其他的报表工具,例如Crystal报表是基于Java的,没有自己的表达式语法.Jasper Repor ...

  3. ActiveReport系列报表开发随笔收集

    转自:博客园 http://www.cnblogs.com/dahuzizyd/archive/2007/04/11/ActiveReport_All.html 使用ActiveReport for ...

  4. JFinal使用笔记3-注册和登录功能开发记录

    首页 开源项目 问答 代码 博客 翻译 资讯 移动开发 招聘 城市圈 当前访客身份:游客 [ 登录 | 加入开源中国 ]   当前访客身份: 游客 [ 登录 | 加入开源中国 ] 软件   土龙 关注 ...

  5. CozyRSS开发记录22-界面退化

    CozyRSS开发记录22-界面退化 1.问题1-HtmlTextBlock 找的这个HtmlTextBlock有很严重的bug,有时候显示不完全,有时候直接就崩了.然后看了下代码,完全是学生仔水平写 ...

  6. CozyRSS开发记录21-默认RSS源列表

    CozyRSS开发记录21-默认RSS源列表 1.默认列表 在第一次使用CozyRSS的情况下,我们让它内置五个RSS源吧: 2.响应RSS源的更新 先不处理RSS源列表项的点击,响应下下拉菜单里的更 ...

  7. CozyRSS开发记录20-CanResizeWithGrip

    CozyRSS开发记录20-CanResizeWithGrip 1.窗口样式 首先,WindowStyle有四种: 然后,对于窗口缩放的ResizeMode,也有四种,CanResize和CanRes ...

  8. CozyRSS开发记录19-窗口标题栏交互

    CozyRSS开发记录19-窗口标题栏交互 1.谈谈对mvvm解耦的看法 在使用mvvm时,如何操作窗口,这是一个问题.这个问题的关键点是:mvvm是把view和viewmodel解耦了的,很多写法一 ...

  9. CozyRSS开发记录18-番外之Atom1.0的支持

    CozyRSS开发记录18-番外之Atom1.0的支持 1.对CozyRSS.Syndication批判一番 由于我工作的主要开发语言是c++,所以会看到我的c#代码写得非常朴素,很多语法糖都没有用上 ...

随机推荐

  1. 多值(in),范围值(between..and)

    多值检测 关键词[in]   查出年龄是23,24,28 的人员信息 select * from T_Employee  where FAge  in (23,25,28) in 后面如果跟子查询, ...

  2. Oracle汉字转拼音package

    --函数GetHzFullPY(string)用于获取汉字字符串的拼音 --select GetHzFullPY('中华人民共和国') from dual; --返回:ZhongHuaRenMinGo ...

  3. python 进度条的编写

    背景: 在执行一些Python脚本时,经常出现执行脚本的过程当中,不知道脚本执行了百分之多少,这个问题一直都让我很苦恼.所以特意总结一下,进度条的编写. #!/usr/bin/env python2. ...

  4. javascript函数setInterval和setTimeout的使用区别详解

    setTimeout和setInterval的使用 这两个方法都可以用来实现在一个固定时间段之后去执行JavaScript.不过两者各有各的应用场景. 方 法 实际上,setTimeout和setIn ...

  5. VS2015调试时没有启动IIS Express Web服务器 或者停止调试时 IIS Express 跟着关闭

    解决方法: 打开 解决方案资源管理器 -> 点选 Web 项目选择 -> 属性 -> Web "服务器"  去掉勾选"将服务器设置应道所有用户" ...

  6. mkdir,rmdir,cp,rm,mv,cat,touch用法

    一.mkdir新建目录 1.进入tmp目录,查看该目录下面的子目录 [root@localhost ~]# cd /tmp[root@localhost tmp]# lshsperfdata_root ...

  7. [转]How to: Create a Custom Principal Identity

    本文转自:https://msdn.microsoft.com/en-us/library/aa702720(v=vs.110).aspx The PrincipalPermissionAttribu ...

  8. Ural 1209. 1, 10, 100, 1000... 一道有趣的题

    1209. 1, 10, 100, 1000... Time limit: 1.0 secondMemory limit: 64 MB Let's consider an infinite seque ...

  9. fixed数据类型

    在处理图形运算,特别是3D图形生成运算时,往往要定义一个Fixed数据类型,我称它为定点数,定点数其时就是一个整形数据类型,他的作用就是把所有数 进行转换,从而得到相应类型的整型表达,然后使用定点数进 ...

  10. chrome快捷键

    常用的为: Ctrl + ]   下一个面板 Ctrl + [   上一个面板 Ctrl + Alt + [ 去上一个历史记录的面板Ctrl + Alt + ]      去下一个历史记录的面板 Ct ...