M
msnews.microsoft.com
Greetings
I have a a simple application with 1 form. On my form I use a
BindingSource to bind a database table to a "table (gridDataView)" (one
in the database, one on my form, 2 different types of tables).
I want to remove the current row I tried :
GrantsBindingSource.RemoveCurrent();
this removes it from the list on the form, but does not remove it from
the database, so I tried this :
GrantsBindingSource.RemoveCurrent();
GrantsBindingSource.EndEdit();
this also did not work, so finally I uesd the following :
DataRowView drv = (DataRowView)grantsBindingSource.Current;
AcroDataSet.GrantsRow row = (AcroDataSet.GrantsRow)drv.Row;
grantsTableAdapter.Delete(row.login, row.application, row.level);
grantsBindingSource.RemoveCurrent();
This "works" but seems like a lot to just remove the current record, is
there a "better" way? some way I can use the BindingSource natively and
remove the item from the "list" and the database at the same time?
thanks in advance
troy
I have a a simple application with 1 form. On my form I use a
BindingSource to bind a database table to a "table (gridDataView)" (one
in the database, one on my form, 2 different types of tables).
I want to remove the current row I tried :
GrantsBindingSource.RemoveCurrent();
this removes it from the list on the form, but does not remove it from
the database, so I tried this :
GrantsBindingSource.RemoveCurrent();
GrantsBindingSource.EndEdit();
this also did not work, so finally I uesd the following :
DataRowView drv = (DataRowView)grantsBindingSource.Current;
AcroDataSet.GrantsRow row = (AcroDataSet.GrantsRow)drv.Row;
grantsTableAdapter.Delete(row.login, row.application, row.level);
grantsBindingSource.RemoveCurrent();
This "works" but seems like a lot to just remove the current record, is
there a "better" way? some way I can use the BindingSource natively and
remove the item from the "list" and the database at the same time?
thanks in advance
troy