private void BinData() { string m_tjyf = dateedtTJYF.Text.Trim(); // 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_YGZTJ WHERE 1=1"; if (!string.IsNullOrEmpty(m_tjyf)) { where = string.Format(" {0} and SCYF = '{1}'", where, m_tjyf); } //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_YGZTJ valYgz = new GZ_YGZTJ(); GZ_YGZTJ condYgz = new GZ_YGZTJ(); conn = "connMES"; DataTable dtbYGZ = BLLTable <GZ_YGZTJ> .Factory(conn).qDataTable(where); this.gridYGZ.DataSource = dtbYGZ; gridYGZ.KeyFieldName = "YGBH"; gridYGZ.DataBind(); //执行绑定 ViewState["detailtable"] = dtbYGZ; //dtbRGZMX; }
private void BinData() { string m_tjyf = dateedtTJYF.Text.Trim(); // 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_YGZTJ WHERE 1=1"; if (!string.IsNullOrEmpty(m_tjyf)) { where = string.Format(" {0} and SCYF = '{1}'", where, m_tjyf); } //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_YGZTJ valYgz = new GZ_YGZTJ(); GZ_YGZTJ condYgz = new GZ_YGZTJ(); conn = "connMES"; DataTable dtbYGZ = BLLTable<GZ_YGZTJ>.Factory(conn).qDataTable(where); this.gridYGZ.DataSource = dtbYGZ; gridYGZ.KeyFieldName = "YGBH"; gridYGZ.DataBind(); //执行绑定 ViewState["detailtable"] = dtbYGZ;//dtbRGZMX; }