At 08:32 PM 23/11/2007, you wrote: >Content-class: urn:content-classes:message >Content-Type: multipart/alternative; > boundary="----_=_NextPart_001_01C82DB3.EDD8C10C" > >DbException.ErrorCode is same for unique constraint and foreign key constraint >when using firebird .NET data provider. I need more specific error code to >throw exact exception.
Firebird throws 2 error codes for an exception. The high-level one is the SQLCODE, which is a negative 3-digit code. The lower-level one is the ISC code (or GDSCODE in PSQL) which has 9 digits. Related ISC error types are grouped under the same SQLCODE. In some cases, each successive gdscode error gives you further information about the error condition. In the case you cited, you had two errors both under SQLCODE -530. -- The first that was thrown was for the foreign key violation: isc code 335544466, "Violation of FOREIGN KEY constraint <blah> on table <blah>" -- The next (and last) was isc code 335544839, "Foreign key references are present for the record". However, you have an old firebird.msg file installed that is getting read instead of the correct one for Firebird 2, so the server could not return the message text for it and sent, instead, the default message when that happens, "No message for error code 335544839 found. " The API returns the SQLCODE, the isc code and the text for *all* error conditions it encounters. The last one (first in the stake) is usually the one that gets you closest to the problem. In this case, someone tried to delete the parent record of a foreign key relationship. The first error told you the name of the constraint and the (dependent) table that holds the records affected by the violation. The second error (displayed first) tells you why the delete is disallowed - well, at least, it would have told you, if it could have read the right message file... Tip: you can pick up a doc containing all the error codes and their texts from the documentation area at the main website. Helen ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Firebird-net-provider mailing list Firebird-net-provider@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/firebird-net-provider