Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Raize TrzDBDateTimePicker exception when field has null value?


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Mar 16, 2017 4:16 PM Last Post By: Chris LeFebvre
Chris LeFebvre

Posts: 65
Registered: 10/24/99
Raize TrzDBDateTimePicker exception when field has null value?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 15, 2017 7:32 AM
I'm working on a form that is used to edit a record in a Firebird database that I access using FireDAC, in the table that I'm editing there are a number of date fields and in some cases where no date was ever entered in that field the field is blank / null. When the form is being created and I have a Raize data-aware datetimepicker attached to the field that has a blank date an exception appears to be generated "Project XXX raised exception class EConvertError with message "" is not a valid date and time".

What is the proper way to deal with this? Do I need to change the null values in the database to some value? What would represent "no date"? Is there a way to capture this error like Try / Except and not do anything so that if the user does hit the datetimepicker and they enter a date then the null value will be replaced by the date of the users selection?

Thanks!
Chris LeFebvre

Posts: 65
Registered: 10/24/99
Re: Raize TrzDBDateTimePicker exception when field has null value?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 16, 2017 4:16 PM   in response to: Chris LeFebvre in response to: Chris LeFebvre
I've been trying to work out a solution to this problem and nothing I've tried has worked:

First I tried to wrap the forms creation in a Try Except block:
Try
  EditDataForm := TEditDataForm.Creat(Application);
Except
 On E: Exception Do ShowMessage( E.ClassName );
End


But in this case the Try Except doesn't appear to be catching the error.

Then after some Googling on trying to trap exceptions I found this page [http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/Forms_TApplication_OnException.html] and I tried adding exception handling to the form that contains the date time picker but that didn't work and I tried adding it to the main form where the child form is created and it trapped the error but apparently the TrzDBDateTimePicker is causing a fatal error and the creation of the child form is aborted.

Any ideas?
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02