View Single Post
  #1 (permalink)  
Old December 28th, 2008, 06:40 PM
jn148 jn148 is offline
Authorized User
Join Date: Aug 2008
Location: , , .
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reference Constraint?

You mention in your intro to databases chapter how to setup a diagram in the database to enforce not being able to delete (for example) a category record, if it's ID is used in a record in, say a Products table.

It works, but now when I write a GridView that deletes Category records, I get an ugly reference constraint error. Is there some way to code it in the ItemDeleting code or somewhere to cancel the delete and change a lable.text to "cannot delete category when it is still being referenced in products table" ?

Reply With Quote