private void buttonX2_Click(object sender, EventArgs e) { string name = this.textBoxX2.Text; string gg = this.textBoxX3.Text; string jx = this.textBoxX4.Text; string pzwh = this.textBoxX5.Text; string sql = ""; List <string> fileds = new List <string>(); List <string> values = new List <string>(); if (!string.IsNullOrEmpty(name)) { sql = " And DrugsBase_DrugName like '%" + name + "%'"; fileds.Add("DrugsBase_DrugName"); values.Add(name); } if (!string.IsNullOrEmpty(gg)) { sql += " And DrugsBase_Specification like'%" + gg + "%'"; fileds.Add("DrugsBase_Specification"); values.Add(gg); } if (!string.IsNullOrEmpty(jx)) { sql += " And DrugsBase_Formulation like '%" + jx + "%'"; fileds.Add("DrugsBase_Formulation"); values.Add(jx); } if (!string.IsNullOrEmpty(pzwh)) { sql += " And DrugsBase_ApprovalNumber like '%" + pzwh + "%'"; fileds.Add("DrugsBase_ApprovalNumber"); values.Add(pzwh); } if (!string.IsNullOrEmpty(textBoxX1.Text)) { fileds.Add("DrugsBase_Manufacturer"); values.Add(textBoxX1.Text); } DataSet ds = db.GetDrugsbaseAllList(20, 1, fileds.ToArray(), values.ToArray(), false, key); dataGridViewX1.DataBindings.Clear(); DataTable dt = ds.Tables[0]; dt.Columns.Add("yinyong", typeof(string)); dt.Columns.Add("zhbyy", typeof(string)); foreach (DataRow dr in dt.Rows) { dr["yinyong"] = "药品引用"; dr["zhbyy"] = "转换比引用"; } dataGridViewX1.DataSource = ds.Tables[0]; }
private void buttonX2_Click(object sender, EventArgs e) { string name = this.textBoxX2.Text; string gg = this.textBoxX3.Text; string dj = this.textBoxX4.Text; string zf = this.textBoxX5.Text; string cd = this.textBoxX1.Text; string sql = ""; List <string> fileds = new List <string>(); List <string> values = new List <string>(); if (!string.IsNullOrEmpty(name)) { sql = " And DrugsBase_DrugName='" + name + "'"; fileds.Add("DrugsBase_DrugName"); values.Add(name); } if (!string.IsNullOrEmpty(gg)) { sql += " And DrugsBase_Specification='" + gg + "'"; fileds.Add("DrugsBase_Specification"); values.Add(gg); } if (!string.IsNullOrEmpty(dj)) { sql += " And ProductionLevelName='" + dj + "'"; fileds.Add("ProductionLevelName"); values.Add(dj); } if (!string.IsNullOrEmpty(zf)) { sql += " And ProductionMethodName='" + zf + "'"; fileds.Add("ProductionMethodName"); values.Add(zf); } if (!string.IsNullOrEmpty(cd)) { sql += " And ProductionAddress='" + cd + "'"; fileds.Add("ProductionAddress"); values.Add(cd); } if (!string.IsNullOrEmpty(textBoxX6.Text)) { fileds.Add("DrugsBase_Manufacturer"); values.Add(textBoxX6.Text); } fileds.Add("DrugsBase_Formulation"); values.Add("中药饮片"); DataSet ds = db.GetDrugsbaseAllList(20, 1, fileds.ToArray(), values.ToArray(), false, key); DataTable dt = ds.Tables[0]; dt.Columns.Add("yinyong", typeof(string)); foreach (DataRow dr in dt.Rows) { dr["yinyong"] = "引用"; } dataGridViewX1.DataBindings.Clear(); dataGridViewX1.DataSource = dt; }