If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Handling database errors

06-06-2016, 03:26 PM

I wonder if anybody has managing database errors. For example: I add a new record which is set UNIQUE attribute in the table. The database (in my case MySQL) generates an error (along with the Errorcode() ) and SC App - pops up a message like the one below.

I would like to replace this message with my own (custom message).
In this case I would like to read the Errorcode() from MySQL and based on that display Message(1) OR Message(2) if the code is different.
I looked up the MACRO HELP but the descriptions are all garbage. It seems like the one who wrote the help for macro was drunk!
BTW. I need to read the database ErrorCode() NOT the ErrorString() and based on that display proper message. This seem to be super simple to do but somehow SC does not handle SQL errors very well and the customization is inconvenient.

Comment

I haven't tried this, thanks. This seem to be somewhat helpful but does not provide any user interaction. I would like to be able user to resond (ie.e YES/NO or OK/CANCELL). I think having a Macro would be very helpful. I would love to see something like:

sc_dberror(Parameter1, Param2) where Param1 is database Errornumber()

Another problem is that this simple error handling is available only for forms while there is no way to do the same for other Apps :-(