private void BindData() { FOUNDERPCB.DAL.DBHelper db = new FOUNDERPCB.DAL.DBHelper(); try { FOUNDERPCB.BLL.DATA0172BLL bll = new FOUNDERPCB.BLL.DATA0172BLL(db); var list = (List <DATA0172>)bll.FindBySql(string.Format(" STATUS_OF_MO=4 and MO_NUMBER like '%{0}%' order by MO_NUMBER", textBoxCode.Text.Trim())); dataGridView1.DataSource = null; dataGridView1.DataSource = list; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { db.CloseConnection(); } }
private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (dataGridView1.CurrentCell != null && e.RowIndex >= 0) { FOUNDERPCB.DAL.DBHelper db = new FOUNDERPCB.DAL.DBHelper(); try { FOUNDERPCB.BLL.DATA0172BLL bll = new FOUNDERPCB.BLL.DATA0172BLL(db); Data0172 = bll.getDATA0172ByRECORD_KEY_MO(decimal.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString())); this.DialogResult = DialogResult.OK; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { db.CloseConnection(); } } }