jevie jevie - 1 year ago 74
SQL Question

SQL Error Message in the Exception as User Defined Error Message

I have a table with the following design:

Fields: property_id(Primary Key),property_name and fpp_id(Foreign Key From another Table tbl_fpp)

Fields: fpp_id(primary_key),fpp_name

I have Rows inserted to both tables.

Every time I insert in the
I also get the
from another table.

I wanted to throw an exception to the User in my Visual Basic Application that if I delete a
record, if that record is used/referenced in the
then I will prompt the user a message like. "You cannot delete an FPP because it is used in other record." Else it will delete the record of
if it is not referenced?

Answer Source
RAISERROR (N' You cannot delete an FPP because it is used in other record.' , -- Message text.
       10, -- Severity,
       1, -- State)

You can find more detail here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download