Hello,
Hoping you can give some feedback. Using dbexpoda40.dll with Delphi 2010.
On exiting a DBEdit whose field type is a TSQLTimeStampField when an invalid date is entered, I receive the exception "Could not parse SQL TimeStamp String". I am attempting to intercept this exception to give the user a more specific message. Do you have any suggestions as to an approach?
Thank you,
Mike Malinowski
PRG
TSQLTimeStamp Validation Issue
Re: TSQLTimeStamp Validation Issue
hello,
To intercept this error, you can use the SetText event of this field, or validate the inserted data by yourself using the TryStrToSqlTimeStamp method:
or intercept this error:
To intercept this error, you can use the SetText event of this field, or validate the inserted data by yourself using the TryStrToSqlTimeStamp method:
Code: Select all
procedure TForm1.ClientDataSet1F_TIMESTAMPSetText(Sender: TField;
const Text: string);
var
Value: TSQLTimeStamp;
begin
if TryStrToSqlTimeStamp(Text, Value) then
TSQLTimeStampField(Sender).SetData(@Value, False)
else
ShowMessage('Error');}
end;
Code: Select all
procedure TForm1.ClientDataSet1F_TIMESTAMPSetText(Sender: TField;
const Text: string);
begin
try
TSQLTimeStampField(Sender).AsString := Text;
except
on e: EConvertError do
ShowMessage(e.Message);
end;
end;
Re: TSQLTimeStamp Validation Issue
Hello,
Have not implemented yet.
Just wanted to thank you for your reply.
Mike Malinowski
Have not implemented yet.
Just wanted to thank you for your reply.
Mike Malinowski