zoukankan      html  css  js  c++  java
  • 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="ReportFilesRepairCountReport.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();
    
            }
    

      到这就算整个报表都已经做完了看看效果吧

  • 相关阅读:
    二叉树的创建、递归,非递归遍历
    一文读懂PID控制算法(抛弃公式,从原理上真正理解PID控制)
    说走就走的旅行 ——一个人重游长安
    OpenCV笔记:pyrDown()函数和pryUp()函数的使用
    考研心得--一个差劲的ACMer
    HDU 3530 --- Subsequence 单调队列
    POJ 3494 Largest Submatrix of All 1’s 单调队列||单调栈
    极角排序详解:
    POJ 3268 Silver Cow Party 最短路—dijkstra算法的优化。
    给出 中序&后序 序列 建树;给出 先序&中序 序列 建树
  • 原文地址:https://www.cnblogs.com/jxluowei/p/3899516.html
Copyright © 2011-2022 走看看