/// <summary> /// 获得检验科室 /// </summary> /// <returns></returns> public DataTable Getjydept(int jgbm) { try { if (myQuery == null) { myQuery = new DbQuery(); } DataTable tb = new DataTable(); tb = myQuery.GetDept(0, jgbm); //if (tb.Rows.Count == 0) //{ // //MessageBox.Show("错误,未能取得化验科室信息!"); // return tb; //} //add by zouchihua 2013-6-13 增加一个全部 DataTable temp = tb.Clone(); temp = FrmMdiMain.Database.GetDataTable(" select 0 id ,'全部' name"); DataRow r; for (int i = 0; i < tb.Rows.Count; i++) { r = temp.NewRow(); r["id"] = tb.Rows[i]["id"]; r["name"] = tb.Rows[i]["name"]; temp.Rows.Add(r); } return(temp); } catch { return(new DataTable()); } }
private void getDept() { DataTable tb = myQuery.GetDept(0, FrmMdiMain.Jgbm); if (tb.Rows.Count == 0) { MessageBox.Show("错误,未能取得化验科室信息!"); return; } cmbDept.DisplayMember = "NAME"; cmbDept.ValueMember = "ID"; cmbDept.DataSource = tb; // cmbDept.SelectedValue=DeptID;//先显示'检验科' tb = null; }