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 ...
随机推荐
- Get和Post的请求
get post请求 <form method="post","get", action="a.ashx"> <input ...
- 自动布局库--Masonry使用
参考资料(戳这里): > Masonry官网 > Masonry介绍与使用实践(快速上手Autolayout) > iOS 开发实践之 Auto Layout > Ma ...
- LeetCode Unique Binary Search Trees (DP)
题意: 一棵BST有n个节点,每个节点的key刚好为1-n.问此树有多少种不同形态? 思路: 提示是动态规划. 考虑一颗有n个节点的BST和有n-1个节点的BST.从n-1到n只是增加了一个点n,那么 ...
- COGS 11. 运输问题1
★★☆ 输入文件:maxflowa.in 输出文件:maxflowa.out 简单对比时间限制:1 s 内存限制:128 MB [问题描述] 一个工厂每天生产若干商品,需运输到 ...
- 新建framework的bundle资源 linker command failed with exit code 1解決
enable bitcode 设为no
- UVA 10564 Paths through the Hourglass(背包)
为了方便打印路径,考虑从下往上转移.dp[i][j][S]表示在i行j列总和为S的方案, dp[i][j][S] = dp[i+1][left][S-x]+dp[i+1][right][S-x] 方案 ...
- python_30_购物车复习
prodcut_list=[ ('Iphone', 5800), ('Mac Pro', 9800), ('Bike', 800), ('Watch', 10600), ('Coffee', 31), ...
- [solr 管理界面] - 索引数据删除
删除solr索引数据,使用XML有两种写法: 1) <delete><id>1</id></delete> <commit/> 2) < ...
- 利用Theano理解深度学习——Multilayer Perceptron
一.多层感知机MLP 1.MLP概述 对于含有单个隐含层的多层感知机(single-hidden-layer Multi-Layer Perceptron, MLP),可以将其看成是一个特殊的Logi ...
- ubuntu安装R时候增加软件源到sources.list,sudo apt-get update不能更新
http://forum.ubuntu.org.cn/viewtopic.php?t=401717 ubuntu安装R时候增加软件源到sources.list,sudo apt-get update不 ...