RDLC

  1         private void binder()
  2         {
  3             if (Request.QueryString["index"] != null)
  4             {
  5                 DropDownList1.SelectedIndex = Convert.ToInt32(Request.QueryString["index"]);
  6             }
  7             if (Request.QueryString["startime"] != null)
  8             {
  9                 yys.Text = Request.QueryString["startime"].ToString();
 10             }
 11 
 12             if (Request.QueryString["endtime"] != null)
 13             {
 14                 yye.Text = Request.QueryString["endtime"].ToString();
 15             }
 16 
 17             HF.BLL.contractstration bc = new HF.BLL.contractstration();
 18 
 19             DataTable dt = new DataTable();
 20 
 21             string sqlStr = "select CONVERT(varchar(12) , CSDate, 11 ) as CSDate,(select TFName from technologyfield where id= CSIndustry) as CSIndustry,COUNT(*)as CT from contractstration group by CSIndustry,CSDate";
 22 
 23             if (yys.Text.Trim().Equals("") || yye.Text.Trim().Equals(""))
 24             {
 25                 dt = bc.GetAllList(sqlStr).Tables[0];
 26             }
 27             else
 28             {
 29                 sqlStr = "select CONVERT(varchar(12) , CSDate, 11 ) as CSDate,(select TFName from technologyfield where id= CSIndustry) as CSIndustry,COUNT(*)as CT from contractstration where CSDate >='" + yys.Text.Trim() + "' and CSDate<='" + yye.Text.Trim() + "' group by CSIndustry,CSDate";
 30 
 31                 dt = bc.GetAllList(sqlStr).Tables[0];
 32 
 33                 DateTime time = Convert.ToDateTime(yys.Text.Trim());
 34 
 35                 bool isTime = false;
 36 
 37 
 38                 while (time <= Convert.ToDateTime(yye.Text.Trim()))
 39                 {
 40                     DataRow dr = dt.NewRow();
 41                     isTime = false;
 42 
 43                     for (int i = 0; i < dt.Rows.Count; i++)
 44                     {
 45                         if (time == Convert.ToDateTime(dt.Rows[i]["CSDate"]))
 46                         {
 47                             isTime = true;
 48                         }
 49                     }
 50                     if (!isTime)
 51                     {
 52                         string Month = "";
 53 
 54                         string Day = "";
 55 
 56                         if (time.Month <= 9)
 57                         {
 58                             Month = "0" + time.Month;
 59                         }
 60                         else
 61                         {
 62                             Month = time.Month.ToString();
 63                         }
 64                         if (time.Day <= 9)
 65                         {
 66                             Day = "0" + time.Day;
 67                         }
 68                         else
 69                         {
 70                             Day = time.Day.ToString();
 71                         }
 72 
 73                         dr["CSDate"] = time.Year.ToString().Substring(2, 2) + "/" + Month + "/" + Day;
 74 
 75                         dr["CSIndustry"] = "当日没有交易";
 76 
 77                         dr["CT"] = 0;
 78 
 79                         dt.Rows.Add(dr);
 80                     }
 81                     time = time.AddDays(1);
 82                 }
 83             }
 84             dt.DefaultView.Sort = "CSDate asc";
 85 
 86             dt = dt.DefaultView.ToTable();
 87 
 88             if (DropDownList1.SelectedIndex == 0)
 89             {
 90                 ReportViewer1.LocalReport.ReportPath = "ContractAnalysis\\TradingVolume.rdlc";
 91             }
 92             else
 93             {
 94                 ReportViewer1.LocalReport.ReportPath = "ContractAnalysis\\TradingVolumeDetial.rdlc";
 95             }
 96 
 97 
 98             //Microsoft.Reporting.WebForms.ReportParameter[] pream = { new Microsoft.Reporting.WebForms.ReportParameter("datetimeStar", DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd")), new Microsoft.Reporting.WebForms.ReportParameter("datetimeEnd", DateTime.Now.ToString("yyyy-MM-dd")) };
 99 
100             //ReportViewer1.LocalReport.SetParameters(pream);
101             ReportViewer1.LocalReport.DataSources.Clear();
102             ReportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1_Count", dt));
103         }

需求说明:(现在的程序都是自己说了算,你们懂得,没需求,直接上项目,做完客户看,看完边疼边改)

图表统计重点行业交易量分析

报表统计重点行业交易量数据

简称:看形势、导数据。

图表和报表的检索方法一样,所以用了一个页面显示两个rdlc 在这产生了一个问题:

用DropDownList 判断绑定rdlc,只能绑定一次,不可更改(求教因为什么?)

每次更改,我用页面重定向传参再绑定Rdlc

后期变动:

报表导出数据定需要更改。

 

posted @ 2012-06-11 16:50  多睡发芽  阅读(668)  评论(0)    收藏  举报