private void btn_calculation_Click(object sender, EventArgs e)
        {
            //开始汇总
            int           date_count = 0;
            List <string> date_list  = null;

            switch (lbl_tablename.Text)
            {
            case "WATERRETRIEVAL":
                //处在选择的时间范围内的天数
                date_count = DataBaseOperate.get_DateCount(dT_maize_s.Value, dT_maize_e.Value, "WATERRETRIEVAL_PLOT");
                //获取具体的时间列表
                date_list = DataBaseOperate.get_DateDetail(dT_maize_s.Value, dT_maize_e.Value, "WATERRETRIEVAL_PLOT");
                break;

            case "CHLOROPHYLLRETRIEVAL":
                date_count = DataBaseOperate.get_DateCount(dT_maize_s.Value, dT_maize_e.Value, "CHLOROPHYLLRETRIEVAL_PLOT");
                //获取具体的时间列表
                date_list = DataBaseOperate.get_DateDetail(dT_maize_s.Value, dT_maize_e.Value, "CHLOROPHYLLRETRIEVAL_PLOT");
                break;

            case "CROPYIELD":
                date_count = DataBaseOperate.get_DateCount(dT_maize_s.Value, dT_maize_e.Value, "CROPYIELD_PLOT");
                //获取具体的时间列表
                date_list = DataBaseOperate.get_DateDetail(dT_maize_s.Value, dT_maize_e.Value, "CROPYIELD_PLOT");
                break;

            case "MATUREPERIOD":
                date_count = DataBaseOperate.get_DateCount(dT_maize_s.Value, dT_maize_e.Value, "MATUREPERIOD_PLOT");
                //获取具体的时间列表
                date_list = DataBaseOperate.get_DateDetail(dT_maize_s.Value, dT_maize_e.Value, "MATUREPERIOD_PLOT");
                break;
            }

            //获取Countycount
            int Countycount = AggregateToCounty.getCountyCount();
            //获取具体的CountyCode
            List <string> CountyCode_list = AggregateToCounty.get_CountyCode();
            //获取CropCount
            int CropCount = DataBaseOperate.get_CropCount();
            //获取具体的CropCode
            List <string> CropCode_list = DataBaseOperate.get_CropCode();

            //开始汇总
            if (date_count != 0)
            {
                for (int i = 0; i < date_count; i++)        //datetime循环
                {
                    for (int j = 0; j < Countycount; j++)   //villagecode循环
                    {
                        for (int k = 0; k < CropCount; k++) //crop_count循环
                        {
                            //输入查询限制条件,执行存储过程
                            SqlParameter[] param = new SqlParameter[] {
                                new SqlParameter("@time", Convert.ToDateTime(date_list[i])),
                                new SqlParameter("@code", CropCode_list[k]),
                                new SqlParameter("@countycode", CountyCode_list[j]),
                                new SqlParameter("@sum_result", SqlDbType.Float)
                            };
                            param[3].Direction = ParameterDirection.Output;
                            string value = "";
                            switch (lbl_tablename.Text)
                            {
                            //计算汇总结果,并加入到datatable中
                            case "WATERRETRIEVAL":
                                value = AggregateToCounty.get_CountyValue("calc_county_WATERRETRIEVAL", param);
                                break;

                            case "CHLOROPHYLLRETRIEVAL":
                                value = AggregateToCounty.get_CountyValue("calc_county_CHLOROPHYLLRETRIEVAL", param);
                                break;

                            case "CROPYIELD":
                                value = AggregateToCounty.get_CountyValue("calc_county_CROPYIELD", param);
                                break;

                            case "MATUREPERIOD":
                                value = AggregateToCounty.get_CountyValue("calc_county_MATUREPERIOD", param);
                                break;
                            }
                            if (value != "")
                            {
                                DataRow row = dt.NewRow();
                                row["农场"]   = DataBaseOperate.getCountyName(CountyCode_list[j]);
                                row["监测时间"] = Convert.ToDateTime(date_list[i]).ToShortDateString();
                                row["作物类型"] = DataBaseOperate.get_CropCHName(CropCode_list[k]);
                                row["汇总结果"] = float.Parse(value);
                                row["汇总时间"] = DateTime.Now.ToShortDateString();
                                dt.Rows.Add(row);
                            }
                        }
                    }
                }
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("请检查输入条件或统计数据!");
                }
                else
                {
                    dataGridView1.DataSource = dt;
                }
            }
            else
            {
                MessageBox.Show("此时间段内,没有统计数据!");
            }

            InitDataSet();
        }