Dear all,
I have an asp.net webform which will provide delete function. If there are foreign key constraint and the user click the delete button, i would like the user to get response (Eg You must delete other data first......or something like this)
1. Any good idea?
2. One way i search from this form is like this, it raise error in db side(stored proc)
IF EXISTS (SELECT id FROM A WHERE ID = @.ID)
BEGIN
RAISERROR (''VersionA.)
RETURN
END
IF EXISTS (SELECT id FROM A WHERE ID = @.ID)
BEGIN
RAISERROR (''VersionB.)
RETURN
END
How can i get the raiseerror and identiy the veriosn of error in asp.net page?
Thanks in advance!!!!
Return a value to indicate that child records exists. Raising an error is not good idea due to performance.
|||This should already be taken care of from the sql side as long as youhave enforce constraits on for deleting and crud operations. Allyou have to do is catch the SQL errors and handle them from your aspxwhich isnt hard. Search handling sql errors from the codebehind. All you would have to do is handle the event and showjavascript to the user that you need to delete things.
No comments:
Post a Comment