我遇到以下异常
无法将'system.windows.forms.bindingsource'类型的对象强制转换为'system.data.datatable'
这是我的方法
private void GridViewStudentsList_RowValidated(object sender, DataGridViewCellEventArgs e) {
try {
BindingSource bindingSource = (BindingSource) GridViewStudentsList.DataSource;
DataTable changes = (DataTable) bindingSource.DataSource;
changes.GetChanges();
if (changes != null) {
OracleConnection con = new OracleConnection(connection);
con.Open();
OracleDataAdapter adapter = new OracleDataAdapter();
OracleCommandBuilder mcb = new OracleCommandBuilder(adapter);
adapter.UpdateCommand = mcb.GetUpdateCommand();
adapter.Update(changes);
changes.AcceptChanges();
MessageBox.Show("Cell Updated");
con.Close();
return;
}
} catch (Exception ex) {
MessageBox.Show(ex.Message);
}
}
答案 0 :(得分:0)
我犯了一些小错误
No. of Occurences(view)