By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,370 Members | 1,534 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,370 IT Pros & Developers. It's quick & easy.

Refreshing datagridview contents after a failed delete in bound datagridview

P: n/a
Bob
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,

Bob

Jan 5 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.