Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread DateTime Field
Tue, Oct 3 2006 3:05 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Most field types I can set to null which has the same effect (I think) as .Clear

DateTime fields I get an error - can't convert null to double

As part of my mail and newsreader I need to convert text to date and time but when the header is malformed (probably deliberately by spammers) my conversion routine returns a null which generates an error. My function returns a TDateTime. What, other than setting it to zero, can I do?

Roy Lambert
Tue, Oct 3 2006 10:17 AMPermanent Link

"Scott Martin"
Roy,

I use:
      FieldByName(FieldName).Clear;
to clear any type of field and I get no errors.

Using DBi (set field to null simply) calls this to clear the field of any type.

perhaps an sql call?
update tablename set fieldname = null where conditionfield = value

What is your code?

Regards,
Scott.


"Roy Lambert" <roy.lambert@skynet.co.uk> wrote in message
news:988A9D37-130C-4EC7-B0E1-E78FE48FECB2@news.elevatesoft.com...
> Most field types I can set to null which has the same effect (I think) as .Clear
>
> DateTime fields I get an error - can't convert null to double
>
> As part of my mail and newsreader I need to convert text to date and time but when the header is malformed (probably
> deliberately by spammers) my conversion routine returns a null which generates an error. My function returns a
> TDateTime. What, other than setting it to zero, can I do?
>
> Roy Lambert

Tue, Oct 3 2006 12:33 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Scott


Its of the nature

tableFIELD.AsDateTime := ConvertToGMT(Date_As_Text_From_EMail)

All the error trapping of the conversion is done in the conversion routine but it looks as though I'll have to wrap all the assignments in a try .. except block.

Roy Lambert
Image