Link to home
Start Free TrialLog in
Avatar of ivobauer
ivobauer

asked on

Catching database exceptions

I have TTable component with persistent fields pointing to a local table (FoxPro). Further, I have form on which user enters data to my table. I need to catch exceptions which occur when end-user enters invalid value into data-aware component (or such value is assigned to a field programatically in code), for example a string value into TDBEdit that points to TDateField. Such exceptions are raised before actual posting to table, therefore they don't trigger OnPostError event.

Thanks for Help, Ivo.
Avatar of kretzschmar
kretzschmar
Flag of Germany image

hi ivo,

each tfield has an onvalidate-event, where you canb place your own validation. this event is fired before the vcl tries to place the value into the current record-buffer.

maybe thats a point for you to catch a possible exception before one is raised automatically.

also you can use the onsettext-event of the tfield, by trying to set the value byself into the recordbuffer, and raising an exception byself, if the try failed.

tell me, if you need a sample

meikl
Avatar of ivobauer
ivobauer

ASKER

I'll be very appreciated if you send me some code sample.
ASKER CERTIFIED SOLUTION
Avatar of kretzschmar
kretzschmar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Posting the points to you. Thanks!
:-) thanks, hope it helps, good luck again