private void btnQuery_Click(object sender, System.EventArgs e) { Session.Remove("QUERY"); Session.Remove("toExcel"); strBeginDate = Request.Form["txtBegin"].ToString(); strEndDate = Request.Form["txtEnd"].ToString(); if (strBeginDate == "" || strEndDate == "" || strBeginDate == null || strEndDate == null) { this.SetErrorMsgPageBydir("时间不能为空,请重新选择时间!"); return; } string strDeptID = this.ddlDept.SelectedValue; string strProductType = this.ddlProductType.SelectedValue; string strProductClass = this.ddlProductClass.SelectedValue; Hashtable htPara = new Hashtable(); htPara.Add("strBeginDate", strBeginDate); htPara.Add("strEndDate", strEndDate); htPara.Add("strDeptID", strDeptID); htPara.Add("strProductType", strProductType); htPara.Add("strProductClass", strProductClass); Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; StoBusi = new BusiComm.StorageBusi(strcons); try { DataTable dtout = StoBusi.GetStorageCheckLog(htPara); if (dtout == null) { this.SetErrorMsgPageBy2dir("查询出错,请重试!"); return; } else { dtout.TableName = "库存盘点日志"; DataTable dtexcel = dtout.Copy(); Session["QUERY"] = dtout; Session["toExcel"] = dtexcel; if (dtout.Rows.Count <= 0) { btnExcel.Enabled = false; } else { btnExcel.Enabled = true; } } UcPageView1.MyDataGrid.PageSize = 20; DataView dvOut = new DataView(dtout); this.UcPageView1.MyDataSource = dvOut; this.UcPageView1.BindGrid(); } catch (Exception er) { this.clog.WriteLine(er); this.SetErrorMsgPageBy2dir("查询错误,请重试!"); return; } }