I have relational integrity set up in my sql server 2005 database that
prevents cascading deletes in some cases.
I'm using a bound datagrid view and a tablenavigator. When I click the
delete button on it then the save button, I get the message saying a foreign
key constraint does not allow the deletion, but the row is no longer shown
in the datagridview. Only way I get to see it is to close my form and open
it again, then row is there OK.
Question is how do I refresh the datagridview after such a failed delete.
I can think of doing the checking to see if there are any child records in
the UI code UserDeletingRows event of the datagrid, then issuing a Cancel so
that the UI prevents the deletion, but that sort of circumvents the purpose
of letting your database doing the integrity checking.
Can anyone give me an idea on how to detect that a delete has failed using
these controls , I know how to do a refill. I just need to know what event
to use to launch it.
Any help appreciated,