日期:2014-05-18 浏览次数:20858 次
private void dgv_InInfo_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { if (dgv_InInfo.CurrentCell.OwningColumn.Name == "ModelCell") { ocnn = new OleDbConnection(connections); ocnn.Open(); string name = dgv_InInfo.CurrentRow.Cells[2].Value.ToString(); string sql = "select * from MIS_MaterielRegiser where MR_Name='" + name + "'"; ocmd = new OleDbCommand(sql,ocnn); oda = new OleDbDataAdapter(ocmd); DataSet ds = new DataSet(); oda.Fill(ds); ((ComboBox)e.Control).DropDownStyle = ComboBoxStyle.DropDown; ((ComboBox)e.Control).DataSource = ds.Tables[0]; ((ComboBox)e.Control).DisplayMember = "MR_Model"; } }