SQL异常中的错误消息为用户定义的错误消息
SQL Error Message in the Exception as User Defined Error Message
我有一个 table 设计如下:
tbl_property
Fields: property_id(Primary Key),property_name and fpp_id(Foreign Key From another Table tbl_fpp)
tbl_fpp
Fields: fpp_id(primary_key),fpp_name
我在两个 table 中都插入了行。
每次我在 tbl_property
中插入时,我也会从另一个 table 中得到 fpp_id
。
我想在我的 Visual Basic 应用程序中向用户抛出一个异常,如果我删除一条 table_fpp
记录,如果该记录在 tbl_property
中是 used/referenced 那么我将提示用户类似的消息。 "You cannot delete an FPP because it is used in other record." 否则如果table_fpp
的记录没有被引用,它会删除它吗?
RAISERROR (N' You cannot delete an FPP because it is used in other record.' , -- Message text.
10, -- Severity,
1, -- State)
您可以在此处找到更多详细信息
http://msdn.microsoft.com/en-us/library/ms178592.aspx
我有一个 table 设计如下:
tbl_property
Fields: property_id(Primary Key),property_name and fpp_id(Foreign Key From another Table tbl_fpp)
tbl_fpp
Fields: fpp_id(primary_key),fpp_name
我在两个 table 中都插入了行。
每次我在 tbl_property
中插入时,我也会从另一个 table 中得到 fpp_id
。
我想在我的 Visual Basic 应用程序中向用户抛出一个异常,如果我删除一条 table_fpp
记录,如果该记录在 tbl_property
中是 used/referenced 那么我将提示用户类似的消息。 "You cannot delete an FPP because it is used in other record." 否则如果table_fpp
的记录没有被引用,它会删除它吗?
RAISERROR (N' You cannot delete an FPP because it is used in other record.' , -- Message text.
10, -- Severity,
1, -- State)
您可以在此处找到更多详细信息 http://msdn.microsoft.com/en-us/library/ms178592.aspx