December 28, 2005 at 2:29 pm
If I execute any statement in SQL, @@Error will have an error code associated with that operation.
master.dbo.sysmessages will have a "decsription" of the message. It also has placeholders to pass in values, if needed.
There is also FormatMessage which will take an Error Code, and "N" parameters to return a nice message.
My question is: How do I put all of these together to get a proper error message?
Error 547 has this description:
How do I know how many parameters I will need? Can I even use this mess to give my users something inteligible?
Thank You,
Bryan Clauss
December 28, 2005 at 6:44 pm
Thats because Error Number 547 is a generic 'Foreign Key violation' type error. One suggestion would be to display to the user something like 'Unable to save/modify data due to data mismatch'.
At the end of the day, no matter how friendly/unfriendly the error message displays, it will come to you to fix anyway!
December 29, 2005 at 8:00 am
I was using Error # 547 as an example. (This is what MS SQL Help had as an example.)
If I recieve an error, should I just pass to the user that there was an Error, and let it go at that? (Some users are actually good about taking screen shots, and telling us IT people what they were doing at the time, and the rest just tell us (if they even bother) this: "I got an error last week. Fix it.")
Thanks,
Bryan
December 29, 2005 at 8:59 am
The complete errormessage will always be sent to the client, it's not even possible in some cases to trap the errormessage in your T-SQL code.
How it is handled and displayed to the client, though, is dependeing on how the client app is coded.
/Kenneth
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply