visual studio 2010 自带reporting报表本地加载的使用
原文:visual studio 2010 自带reporting报表本地加载的使用
在这家公司时间不长,接触都是之前没玩过的东东,先是工作流引擎和各种邮件短信的审核信息,后又是部署reporting服务器。
reporting服务部署就不在这多说,在vs2010里面是自带了reporting报表的直接添加就可以使用。如图

这是一个空白的模板。这时模板已有了就差数据了在新加一个数据集DataSet

数据集有了模板有了就回到reporting模板页在这上面设计格式了,在空白处 右键-插入-表(也可以是其他图表之类)选择数据源

此时的报表模板就和绑定web控件一样设定对于字段

到这模板设定就完成了。接着去写对应的加载页面了aspx的html如下
<rsweb:ReportViewer ID="rvReport" runat="server" Font-Names="Verdana"
Font-Size="8pt" WaitMessageFont-Size="14pt" InteractiveDeviceInfos="(集合)" WaitMessageFont-Names="Verdana"
Width="100%" Height="90%">
<LocalReport ReportPath="ReportFiles\RepairCountReport.rdlc">
<DataSources>
<rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1"/>
</DataSources>
</LocalReport> </rsweb:ReportViewer>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server">
</asp:ObjectDataSource>
在cs文件加载数据代码如下
private void InitDataGrid()
{
string betweenBegin = BetweenBegin.Value;
string betweenEnd = BetweenEnd.Value;
if (string.IsNullOrWhiteSpace(betweenBegin) || string.IsNullOrWhiteSpace(betweenEnd))
{
PromptHelper.ShowMessageJbox("温馨提示", "请输入查询区间", this);
return;
}
//默认是选中即油站名称进行分组
string groupbyValue = "";
if (ckOuName.Checked)
{
groupbyValue = "1";
}
else
{
groupbyValue = RadioButtonList1.SelectedValue;
}
sqlWhere = " and (T1.ActualFinishDate BETWEEN '" + betweenBegin + "' AND '" + betweenEnd + "') ";
string ouName=OUName.Value;
if (!string.IsNullOrWhiteSpace(ouName) && ouName != "油站名称")
{
sqlWhere += " and T3.OUName like '%" + ouName + "%'";
}
//先获取数据
SqlHelper helper = new SqlHelper();
SqlParameter[] par = new SqlParameter[]{
new SqlParameter("@sqlWhere",SqlDbType.VarChar,1000),
new SqlParameter("@groupby",SqlDbType.VarChar,2)
};
par[0].Value = sqlWhere;
par[1].Value = groupbyValue;
DataSet DataSet1 = helper.ExecuteDataSet(CommandType.StoredProcedure, "proc_RepairCountReport", par);
this.rvReport.Visible = true; this.rvReport.LocalReport.DataSources.Clear(); ObjectDataSource1.SelectParameters.Clear();
ObjectDataSource1.SelectParameters.Add("sqlWhere", sqlWhere);
this.rvReport.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", DataSet1.Tables[0]));
this.rvReport.LocalReport.Refresh(); }
到这就算整个报表都已经做完了看看效果吧

visual studio 2010 自带reporting报表本地加载的使用的更多相关文章
- 打开visual studio 2010报错:未能正确加载“VSTS for Database Professionals Sql Server Data-tier Application”包
1 解决: 运行cmd 2 输入:regsvr32 %windir%\system32\jscript.dll
- Visual Studio 2008 Package Load Failure:未能正确加载包“Microsoft.VisualStudio.Xaml”
在安装好Visual Studio 2008后,启动Visual Studio 2008 发现如下提示: 包加载失败 未能正确加载包“Microsoft.VisualStudio.Xaml”( GUI ...
- Visual Studio的NuGet包管理器无法加载
由于网络原因,虽然地址http://www.nuget.org和https://www.nuget.org/api/v2/在浏览器可以正常打开,但是在VS中使用默认的NuGet程序包源经常加载不出来, ...
- 打开Visual Studio 2017报错:未能正确加载“VSTS for Database Professionals Sql Server Data-tier Application”包
出现如下错误 解决办法 > cmd > regsvr32 %windir%\system32\jscript.dll
- 水晶报表初体验(Visual Studio 2010)
安装水晶报表后如下使用: 配置rpt文件,如图 前台(Asp.net页面): <%@ Register Assembly="CrystalDecisions.Web, Version= ...
- Visual Studio 2010打开水晶报表是出现二进制
水晶报表在64位的机器下未安装成功 解决方法 到http://www.cnblogs.com/siyunianhua/p/4806513.html下载 水晶报表VS2010版IDE安装标准版SAP ...
- Visual Studio 2010 SP1 在线安装后,找到缓存在本地的临时文件以便下次离线安装
由于在下载Visual Studio 2010安装程序(大约3G左右)的时候速度飞快,大约几分钟下载完毕(多线程下载工具下载),所以笔者在继续安装Visual Studio 2010 SP1的时候也选 ...
- Visual Studio 2010 RDLC 报表简单使用
原文:Visual Studio 2010 RDLC 报表简单使用 RDLC(Report Definition Language Client-side Processing)是Visual Stu ...
- 使用Visual Studio下自带的SQL Server Express
软件环境:Windows7(x64) + Visual Studio 2010 + SQL Server Express 2008 1.配置数据库 装VS2010不小心把自带的SQL Server 2 ...
随机推荐
- xml 文件转化Dictionary
下面是xml文件 <?xml version="1.0" encoding="utf-8" ?><nodes> <国土局> ...
- Backbone源码风格
代码风格: 一.自执行匿名函数创建执行环境 var root = this; root保存全局执行环境的指针.浏览器端为window对象 二.依赖库 (1).underscore 如果bac ...
- 使用kvm制作Eucalyptus镜像(CentOS 6.5为例)
1.前言 Elastic Utility Computing Architecture for Linking Your Programs To Useful Systems (Eucalyptus) ...
- uLua学习之数据交互(三)
前言 在上节中,大概谈了一下如何在lua脚本中调用unity3d中的方法来创建游戏物体,这只是很小的一个方面,uLua的优势在于对unity3d中C#语言的扩展和定制.那么如何扩展和定制呢?其中的数据 ...
- MAC MAMP install yaf
Yaf doesn't support PHP 5.6! You may see this: Warning: PHP Startup: yaf: Unable to initialize modul ...
- HDU1075 字典树 + 字符串映射
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1075 ,字典树的字符串映射. 题意是给你每个火星文单词对应的英语,然后让你把一篇火星文文章给翻译成英语 ...
- c++ vector & 二维数组 & MessageBox
vector: https://www.cnblogs.com/mr-wid/archive/2013/01/22/2871105.html c++ 二维数组: int **p; p = new in ...
- linux 命令——49 at (转)
在windows系统中,windows提供了计划任务这一功能,在控制面板 -> 性能与维护 -> 任务计划, 它的功能就是安排自动运行的任务. 通过'添加任务计划'的一步步引导,则可建立一 ...
- ZooKeeper保证之单一视图(Single System Image)
由于ZooKeeper的数据模型简单且全部在内存中,ZooKeeper的速度非常快.它提供了一系列保证(Guarantees): • 顺序一致性(Sequential Consistency) • 原 ...
- 漫谈 Clustering (番外篇): Dimensionality Reduction
由于总是有各种各样的杂事,这个系列的文章竟然一下子拖了好几个月,(实际上其他的日志我也写得比较少),现在决定还是先把这篇降维的日志写完.我甚至都以及忘记了在这个系列中之前有没有讲过“特征”(featu ...