private void BinData() { //string m_scrq1 = dateedtSCRQ1.Text.Trim(); //string m_scrq2 = dateedtSCRQ2.Text.Trim(); string m_scrq1 = dateedtSCRQ1.Date.ToString("yyyy-MM-dd"); //string m_scrq2 = Convert.ToDateTime(dateedtSCRQ2.Text.Trim()).ToString("yyyy-MM-dd");//dateEnd.AddDays(+1).ToString("yyy-MM-dd"); string m_gxid = cbGX.Value.ToString().Trim(); string m_xxlx = cbXXLX.Text.ToString().Trim(); string m_yg = txtYG.Text.ToString().Trim(); string where = "SELECT * FROM GZ_RGZMX WHERE 1=1"; where = string.Format(" {0} and SCRQ = '{1}' ", where, m_scrq1); //if (!string.IsNullOrEmpty(m_scrq1) && !string.IsNullOrEmpty(m_scrq2)) //{ // where = string.Format(" {0} and SCRQ >= '{1}' AND SCRQ <= '{2}'", where, m_scrq1, m_scrq2); //} if (!string.IsNullOrEmpty(m_gxid)) { where = string.Format(" {0} and GXID = '{1}'", where, m_gxid); } if (!string.IsNullOrEmpty(m_xxlx) && m_xxlx != "全部") { if (m_xxlx == "其它") { where = string.Format(" {0} and ( XXLX = '{1}' OR XXLX = NULL)", where, ""); } else if (m_xxlx == "三相") { where = string.Format(" {0} and substring(XXLX,1,2) = '{1}'", where, m_xxlx); } else { where = string.Format(" {0} and XXLX = '{1}'", where, m_xxlx); } } if (!string.IsNullOrEmpty(m_yg)) { where = string.Format(" {0} and (YGBH LIKE '%{1}%' OR YGXM LIKE'%{1}%')", where, m_yg); } GZ_RGZMX valRgzmx = new GZ_RGZMX(); GZ_RGZMX condRgzmx = new GZ_RGZMX(); //JC_CPXX valCpxx = new JC_CPXX(); //JC_CPXX condCpxx = new JC_CPXX(); //valCpxx._XXLX = ""; //valCpxx._SAPRemark = ""; //valCpxx._XH = ""; //JC_KHXX valKhxx = new JC_KHXX(); //JC_KHXX condKhxx = new JC_KHXX(); //valKhxx._KHMC = ""; conn = "connMEStest"; DataTable dtbRGZ = BLLTable <GZ_RGZMX> .Factory(conn).qDataTable(where); this.gridRGZ.DataSource = dtbRGZ; gridRGZ.DataBind(); //执行绑定 ViewState["detailtable"] = dtbRGZ; //dtbRGZMX; }
private void BinData() { //string m_scrq1 = dateedtSCRQ1.Text.Trim(); //string m_scrq2 = dateedtSCRQ2.Text.Trim(); string m_scrq1 =dateedtSCRQ1.Date.ToString("yyyy-MM-dd"); //string m_scrq2 = Convert.ToDateTime(dateedtSCRQ2.Text.Trim()).ToString("yyyy-MM-dd");//dateEnd.AddDays(+1).ToString("yyy-MM-dd"); string m_gxid = cbGX.Value.ToString().Trim(); string m_xxlx = cbXXLX.Text.ToString().Trim(); string m_yg = txtYG.Text.ToString().Trim(); string where = "SELECT * FROM GZ_RGZMX WHERE 1=1"; where = string.Format(" {0} and SCRQ = '{1}' ", where, m_scrq1); //if (!string.IsNullOrEmpty(m_scrq1) && !string.IsNullOrEmpty(m_scrq2)) //{ // where = string.Format(" {0} and SCRQ >= '{1}' AND SCRQ <= '{2}'", where, m_scrq1, m_scrq2); //} if (!string.IsNullOrEmpty(m_gxid)) { where = string.Format(" {0} and GXID = '{1}'", where, m_gxid); } if (!string.IsNullOrEmpty(m_xxlx) && m_xxlx != "全部") { if (m_xxlx == "其它") { where = string.Format(" {0} and ( XXLX = '{1}' OR XXLX = NULL)", where, ""); } else if (m_xxlx == "三相") { where = string.Format(" {0} and substring(XXLX,1,2) = '{1}'", where, m_xxlx); } else { where = string.Format(" {0} and XXLX = '{1}'", where, m_xxlx); } } if (!string.IsNullOrEmpty(m_yg)) { where = string.Format(" {0} and (YGBH LIKE '%{1}%' OR YGXM LIKE'%{1}%')", where, m_yg); } GZ_RGZMX valRgzmx = new GZ_RGZMX(); GZ_RGZMX condRgzmx = new GZ_RGZMX(); //JC_CPXX valCpxx = new JC_CPXX(); //JC_CPXX condCpxx = new JC_CPXX(); //valCpxx._XXLX = ""; //valCpxx._SAPRemark = ""; //valCpxx._XH = ""; //JC_KHXX valKhxx = new JC_KHXX(); //JC_KHXX condKhxx = new JC_KHXX(); //valKhxx._KHMC = ""; conn = "connMEStest"; DataTable dtbRGZ = BLLTable<GZ_RGZMX>.Factory(conn).qDataTable(where); this.gridRGZ.DataSource = dtbRGZ; gridRGZ.DataBind(); //执行绑定 ViewState["detailtable"] = dtbRGZ;//dtbRGZMX; }