我添加了MaMon值=11,它由datagridview显示,但MaMon组合框不是在此处输入图像描述
我创建void LoadData,并在创建、更新、查看、del 时调用它
void LoadData() {
OleDbConnection conn = new OleDbConnection();
conn.ConnectionString = @"Provider=Microsoft.Jet.Oledb.4.0;Data Source = D:ProjectDataKTHT.mdb";
conn.Open();
OleDbDataAdapter ad = new OleDbDataAdapter("select * from table", conn);
DataTable tb = new DataTable();
ad.Fill(tb);
dataGridView_MonHoc.DataSource = tb;
cboMaMon.DataSource = tb;
cboMaMon.DisplayMember = "TenMon";
cboMaMon.ValueMember = "MaMon";
}