Hope you can help soon.
I have a datagrid winform (Not DataGridView) - that has DataSet in MS Access DataBase as DataSource , and I am using Oledb amd sql statemants in order to make changes to teh Access Database.
I have a datagrid that has CheckBox as first column, and when I select one or more of the checkboxes and then press delete I want to delete the rows from the WinForm DataGrid ( That is ok - done), but I could not delete them from teh MS Access Database.
Code is attached .
Youc an see there datatable.Rows.Remove(theR
); whic deletes the row from teh winform datagrid.
and you can find in teh code a call to DeleteRowFromAccessDataBas
Delete) - which in turn will delete the row from the Access Database. This is not implemented yet.
Can you tell me how can I implement it??
Or if there is any way to tell the Access Database to be updated automatically according to teh changes in teh WinForm DataGrid.
public void DeleteSelectedCheckBoxes()
for (int i = 0; i < datatable.Rows.Count; i++)
if ((bool)datatable.Rows[i] == true)
int index = datatable.Rows.IndexOf(datatable.Rows[i]);
for (int j = listOfCheckedRows.Count-1 ; j>=0 ; j--)
DataRow theRowToDelete = datatable.Rows[Convert.ToInt32(listOfCheckedRows[j])];
m_NumberOfSelectedCheckBoxes = 0;