Subject | How to get error code |
---|---|
Author | Tomy Handaka |
Post date | 2007-11-23T07:21:15Z |
Hi all,
I have to get error code for database exception (.NET) using DbException class. Apparently, there is no way to extract error code directly using DbException class.
When I get foreign key constraint, the message would be this:
"violation of FOREIGN KEY constraint "FK_CLASSBUSINESS_1" on table "CLASSBUSINESS"
No message for error code 335544839 found.
At procedure 'SPDELETEDEPARTMENT'"
So I can get error code (335544839) by parse it from error message.
But, when I get primary key constraint, the message would be this (there is no error code):
"violation of PRIMARY or UNIQUE KEY constraint "DEPARTMENT_PK" on table "DEPARTMENT"
At procedure 'SPINSERTDEPARTMENT'"
How can I get the error code through DbException class? (Note: I don't use FbException class)
[Non-text portions of this message have been removed]
I have to get error code for database exception (.NET) using DbException class. Apparently, there is no way to extract error code directly using DbException class.
When I get foreign key constraint, the message would be this:
"violation of FOREIGN KEY constraint "FK_CLASSBUSINESS_1" on table "CLASSBUSINESS"
No message for error code 335544839 found.
At procedure 'SPDELETEDEPARTMENT'"
So I can get error code (335544839) by parse it from error message.
But, when I get primary key constraint, the message would be this (there is no error code):
"violation of PRIMARY or UNIQUE KEY constraint "DEPARTMENT_PK" on table "DEPARTMENT"
At procedure 'SPINSERTDEPARTMENT'"
How can I get the error code through DbException class? (Note: I don't use FbException class)
[Non-text portions of this message have been removed]