private void showZD() { ZDEntity zdEntity = new ZDEntity(); tbTB.Text = tb; zdEntity.tb = tbTB.Text.Trim(); StringBuilder sql = new StringBuilder(); string lsSql = string.Empty; SqlHelperXhf loSqlHelperXhf = new SqlHelperXhf(Comm.ConnStringFrom); //gnlb.name = tbName.Text.Trim(); //gnlb.zygn = tbZYGN.Text.Trim(); //gnlb.pt = tbPT.Text.Trim(); //gnlb.xt = cbXT.Text.Trim(); sql.Append("Select t10.XT,t10.SJK,t10.TB,t10.TBMS,t10.ZD,t10.ZDMS,t10.ISKEY,t10.KJLX,,t10.SM,,t10.DATATYPE,,t10.SFWK from PMP000901 t10 where 1=1 "); if (!string.IsNullOrEmpty(zdEntity.tb)) { sql.Append(" and TB like '%" + zdEntity.tb + "%'"); } DataTable loDt = loSqlHelperXhf.ExecuteDataTable(lsSql); SJKZDGrid.Columns["jkdgXT"].DataPropertyName = "XT"; SJKZDGrid.Columns["jkdgGN"].DataPropertyName = "GNDM"; SJKZDGrid.Columns["jkdgGNMC"].DataPropertyName = "GNMC"; SJKZDGrid.Columns["jkdgJKDM"].DataPropertyName = "JKDM"; SJKZDGrid.Columns["jkgdJKMC"].DataPropertyName = "JKMC"; SJKZDGrid.Columns["jkgdJKGNMS"].DataPropertyName = "JKGNMS"; SJKZDGrid.Columns["resquest"].DataPropertyName = "REQUEST"; SJKZDGrid.Columns["response"].DataPropertyName = "RESPONSE"; SJKZDGrid.Columns["jkdgFWLJ"].DataPropertyName = "FWLJ"; SJKZDGrid.Columns["jkdgJKDYR"].DataPropertyName = "JKDYR"; SJKZDGrid.Columns["jkdgCZPT"].DataPropertyName = "PT"; SJKZDGrid.AutoGenerateColumns = false; SJKZDGrid.DataSource = loDt; }
/// <summary> /// 绑定系统下拉框 /// </summary> private void BindXT() { DataTable dtXT = new DataTable(); string sql = "select XTDM from PMP000301"; SqlHelperXhf loSqlHelperXhf = new SqlHelperXhf(Comm.ConnStringFrom); dtXT = loSqlHelperXhf.ExecuteDataTable(sql); cmb_Temp.ValueMember = "XTDM"; //cmb_Temp.DisplayMember = "Name"; cmb_Temp.DataSource = dtXT; cmb_Temp.DropDownStyle = ComboBoxStyle.DropDownList; }
//private string code = null; //private string name = null; //private string zygn = null; //private string pt = null; //private string lx = null; //private string createDate = null; //private string cjyh = null; //private string updateDate = null; //private string gxyh = null; //private string xt = null; //查询 private void button1_Click(object sender, EventArgs e) { GNLBEntity gnlb = new GNLBEntity(); string lsSql; StringBuilder sql = new StringBuilder(); gnlb.code = tbCode.Text.Trim(); gnlb.name = tbName.Text.Trim(); gnlb.zygn = tbZYGN.Text.Trim(); gnlb.pt = tbPT.Text.Trim(); gnlb.xt = cbTX.Text.Trim(); //createDate = tbCode.Text.Trim(); //cjyh = tbCode.Text.Trim(); //updateDate = tbCode.Text.Trim(); gnlb.gxyh = tbGXYH.Text.Trim(); sql.Append("Select t10.XT,t10.Code,t10.Name,t10.ZYGN,t10.PT,t10.LX,t10.CreateDate,t10.CJYH,t10.UpdateDate,t10.GXYH from PMP000101 t10 where 1=1 "); //lsSql = "Select t10.XT,t10.Code,t10.Name,t10.ZYGN,t10.PT,t10.LX,t10.CreateDate,t10.CJYH,t10.UpdateDate,t10.GXYH from PMP000101 t10"; if (!string.IsNullOrEmpty(gnlb.code)) { sql.Append(" and Code like '%" + gnlb.code + "%'"); } if (!string.IsNullOrEmpty(gnlb.name)) { sql.Append(" and Name like '%" + gnlb.name + "%'"); } if (!string.IsNullOrEmpty(gnlb.zygn)) { sql.Append(" and ZYGN like '%" + gnlb.zygn + "%'"); } if (!string.IsNullOrEmpty(gnlb.pt)) { sql.Append(" and PT like '%" + gnlb.pt + "%'"); } if (!string.IsNullOrEmpty(gnlb.createDate)) { sql.Append(" and CreateDate like '%" + gnlb.createDate + "%'"); } if (!string.IsNullOrEmpty(gnlb.gxyh)) { sql.Append(" and GXYH like '%" + gnlb.gxyh + "%'"); } if (!string.IsNullOrEmpty(gnlb.xt)) { sql.Append(" and GXYH like '%" + gnlb.xt + "%'"); } SqlHelperXhf loSqlHelperXhf = new SqlHelperXhf(Comm.ConnStringFrom); lsSql = sql.ToString(); DataTable loDt = loSqlHelperXhf.ExecuteDataTable(lsSql); dataGridView1.Columns["XT"].DataPropertyName = "XT"; dataGridView1.Columns["Code"].DataPropertyName = "Code"; dataGridView1.Columns["U_Name"].DataPropertyName = "Name"; dataGridView1.Columns["ZYGN"].DataPropertyName = "ZYGN"; dataGridView1.Columns["PT"].DataPropertyName = "PT"; dataGridView1.Columns["GNLX"].DataPropertyName = "LX"; dataGridView1.Columns["CreateDate"].DataPropertyName = "CreateDate"; dataGridView1.Columns["CJYH"].DataPropertyName = "CJYH"; dataGridView1.Columns["UpdateDate"].DataPropertyName = "UpdateDate"; dataGridView1.Columns["GXYH"].DataPropertyName = "GXYH"; dataGridView1.AutoGenerateColumns = false; dataGridView1.DataSource = loDt; }
public void ShowGNZSJ() { tbCode.Text = code; TableEntity tableEntity = new TableEntity(); string lsSql; string lsSql2; string lsSql3; StringBuilder sql = new StringBuilder(); StringBuilder sql2 = new StringBuilder(); StringBuilder sql3 = new StringBuilder(); tableEntity.gndm = tbCode.Text.Trim(); //gnlb.name = tbName.Text.Trim(); //gnlb.zygn = tbZYGN.Text.Trim(); //gnlb.pt = tbPT.Text.Trim(); //gnlb.xt = cbXT.Text.Trim(); sql.Append("Select t10.XT,t10.GNDM,t10.GNMC,t10.SJK,t10.TABLENAME,t10.TB,t10.ZYGN,t10.PT from PMP000401 t10 where 1=1 "); sql2.Append("Select t10.XT,t10.GNDM,t10.GNMC,t10.YMDM,t10.YMLJ,t10.YMGNMS from PMP000501 t10 where 1=1 "); sql3.Append("Select t10.XT,t10.GNDM,t10.GNMC,t10.JKDM,t10.JKMC,t10.JKGNMS,t10.REQUEST,t10.RESPONSE,t10.FWLJ,t10.JKDYR,t10.PT from PMP000601 t10 where 1=1 "); //lsSql = "Select t10.XT,t10.Code,t10.Name,t10.ZYGN,t10.PT,t10.LX,t10.CreateDate,t10.CJYH,t10.UpdateDate,t10.GXYH from PMP000101 t10"; if (!string.IsNullOrEmpty(tableEntity.gndm)) { sql.Append(" and GNDM like '%" + tableEntity.gndm + "%'"); sql2.Append(" and GNDM like '%" + tableEntity.gndm + "%'"); sql3.Append(" and GNDM like '%" + tableEntity.gndm + "%'"); } //if (!string.IsNullOrEmpty(gnlb.name)) // sql.Append(" and GNMC like '%" + gnlb.name + "%'"); //if (!string.IsNullOrEmpty(gnlb.zygn)) // sql.Append(" and SJK like '%" + gnlb.zygn + "%'"); //if (!string.IsNullOrEmpty(gnlb.pt)) // sql.Append(" and TABLENAME like '%" + gnlb.pt + "%'"); //if (!string.IsNullOrEmpty(gnlb.createDate)) // sql.Append(" and TB like '%" + gnlb.createDate + "%'"); //if (!string.IsNullOrEmpty(gnlb.gxyh)) // sql.Append(" and ZYGN like '%" + gnlb.gxyh + "%'"); //if (!string.IsNullOrEmpty(gnlb.xt)) // sql.Append(" and PT like '%" + gnlb.xt + "%'"); SqlHelperXhf loSqlHelperXhf = new SqlHelperXhf(Comm.ConnStringFrom); lsSql = sql.ToString(); lsSql2 = sql2.ToString(); lsSql3 = sql3.ToString(); DataTable loDt = loSqlHelperXhf.ExecuteDataTable(lsSql); DataTable loDt2 = loSqlHelperXhf.ExecuteDataTable(lsSql2); DataTable loDt3 = loSqlHelperXhf.ExecuteDataTable(lsSql3); dataGridView1.Columns["XT"].DataPropertyName = "XT"; dataGridView1.Columns["gn"].DataPropertyName = "GNDM"; dataGridView1.Columns["GNMC"].DataPropertyName = "GNMC"; dataGridView1.Columns["DataBase"].DataPropertyName = "SJK"; dataGridView1.Columns["BMC"].DataPropertyName = "TABLENAME"; dataGridView1.Columns["Table1"].DataPropertyName = "TB"; dataGridView1.Columns["dgZYGN"].DataPropertyName = "ZYGN"; dataGridView1.Columns["dgPT"].DataPropertyName = "PT"; dataGridView1.AutoGenerateColumns = false; dataGridView1.DataSource = loDt; dataGridView2.Columns["pgdgXT"].DataPropertyName = "XT"; dataGridView2.Columns["pgdgGN"].DataPropertyName = "GNDM"; dataGridView2.Columns["pgdgGNMC"].DataPropertyName = "GNMC"; dataGridView2.Columns["pgdgYMDM"].DataPropertyName = "YMDM"; dataGridView2.Columns["pgdgYMLJ"].DataPropertyName = "YMLJ"; dataGridView2.Columns["pgdgYMGNMS"].DataPropertyName = "YMGNMS"; dataGridView2.AutoGenerateColumns = false; dataGridView2.DataSource = loDt2; dataGridView3.Columns["jkdgXT"].DataPropertyName = "XT"; dataGridView3.Columns["jkdgGN"].DataPropertyName = "GNDM"; dataGridView3.Columns["jkdgGNMC"].DataPropertyName = "GNMC"; dataGridView3.Columns["jkdgJKDM"].DataPropertyName = "JKDM"; dataGridView3.Columns["jkgdJKMC"].DataPropertyName = "JKMC"; dataGridView3.Columns["jkgdJKGNMS"].DataPropertyName = "JKGNMS"; dataGridView3.Columns["resquest"].DataPropertyName = "REQUEST"; dataGridView3.Columns["response"].DataPropertyName = "RESPONSE"; dataGridView3.Columns["jkdgFWLJ"].DataPropertyName = "FWLJ"; dataGridView3.Columns["jkdgJKDYR"].DataPropertyName = "JKDYR"; dataGridView3.Columns["jkdgCZPT"].DataPropertyName = "PT"; dataGridView3.AutoGenerateColumns = false; dataGridView3.DataSource = loDt3; }