Board index » delphi » Problem to show a time field when the time is invalid

Problem to show a time field when the time is invalid


2003-08-03 09:47:45 PM
delphi258
I use Delphi 5 entreprise edition. I use a DBGrid with a TDataSource and a
TQuery to show the data that I need. The data is on a external database an
we don't have access to the code. So I can not control what the user is
entering in that database. In the SQL statement I have to retreive a field
of time type. Recently I had an error that says 'Invalid Time', because the
time that I received was '24:00:00'. Is there an event in the DBGrid that
could help me to trap and override the invalid time with something else ? Or
should I look the TDataSource or TQuery components ?
--
Shidewa
 
 

Re:Problem to show a time field when the time is invalid

1)
My query is a TQuery and the SQL statement look something like this:
Select Item.ItemName, Item.ItemTime...
From Item
...
The problem is the field Item.ItemTime that has an invalid time.
2)
As soon as I try to get or set the value of the field after the AfterOpen
event of the TQuery, I get the error. So, even if I try
FieldByName('MyTimeField').AsString I still get the error.
Shidewa
"Scott Metzger" <XXXX@XXXXX.COM>a écrit dans le message de
Quote
What is your query?

When do you get the error?

Is it possibly to do the following:
TQuery.FieldByName("MyTimeField").AsString

 

Re:Problem to show a time field when the time is invalid

What is your query?
When do you get the error?
Is it possibly to do the following:
TQuery.FieldByName("MyTimeField").AsString
 

Re:Problem to show a time field when the time is invalid

Shidewa writes:
Quote
2)
As soon as I try to get or set the value of the field after the AfterOpen
event of the TQuery, I get the error. So, even if I try
FieldByName('MyTimeField').AsString I still get the error.
Are you using persistent fields?
If so, try getting rid of the persistent fields and/or changing the type
if MyTimeField to String.