Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread OT: date / string in db
Wed, May 2 2007 6:03 AMPermanent Link

"Harry de Boer"
LS,

I encounter a very strange problem (never happend before) and I am
scratching my head, pulling my hairs to figure it out. When a date field is
blank (or null) then that date field must be populated with the date of
today. The routine is simple, always worked, but now I am getting an error:
"Could not convert variant of type (string) into type (date)". I don't know
where the string type gets into the picture. Anyone any ideas?

     ContractObjecten.First;
     while not ContractObjecten.Eof do begin
       if (ContractObjecten['geannuleerd'] = null) or
(ContractObjecten['geannuleerd'] = '') then begin
         ContractObjecten.Edit;
         ContractObjecten['geannuleerd'] := DATE;
         ContractObjecten.Post;
       end;
       ContractObjecten.Next;
     end;

Regards, Harry

Wed, May 2 2007 6:14 AMPermanent Link

Arnd Baranowski
Harry,

I guess the issue is with

(ContractObjecten['geannuleerd'] = '')

If 'geannuleerd' is a date field then you try a string comparison at
this point.

Arnd

Harry de Boer wrote:
> LS,
>
> I encounter a very strange problem (never happend before) and I am
> scratching my head, pulling my hairs to figure it out. When a date field is
> blank (or null) then that date field must be populated with the date of
> today. The routine is simple, always worked, but now I am getting an error:
> "Could not convert variant of type (string) into type (date)". I don't know
> where the string type gets into the picture. Anyone any ideas?
>
>       ContractObjecten.First;
>       while not ContractObjecten.Eof do begin
>         if (ContractObjecten['geannuleerd'] = null) or
> (ContractObjecten['geannuleerd'] = '') then begin
>           ContractObjecten.Edit;
>           ContractObjecten['geannuleerd'] := DATE;
>           ContractObjecten.Post;
>         end;
>         ContractObjecten.Next;
>       end;
>
> Regards, Harry
>
>
Wed, May 2 2007 6:35 AMPermanent Link

"Harry de Boer"
Arnd

I thought of that, but:

     ContractObjecten.First;
     while not ContractObjecten.Eof do begin
       ContractObjecten.Edit;
       ContractObjecten['geannuleerd'] := DATE;
       ContractObjecten.Post;
       ContractObjecten.Next;
     end;

gives the same error.

Regards, Harry

"Arnd Baranowski" <baranowski@oculeus.de> schreef in bericht
news:292C1AA8-A14D-4A45-91DC-A0FE68787763@news.elevatesoft.com...
> Harry,
>
> I guess the issue is with
>
> (ContractObjecten['geannuleerd'] = '')
>
> If 'geannuleerd' is a date field then you try a string comparison at
> this point.
>
> Arnd
>
> Harry de Boer wrote:
> > LS,
> >
> > I encounter a very strange problem (never happend before) and I am
> > scratching my head, pulling my hairs to figure it out. When a date field
is
> > blank (or null) then that date field must be populated with the date of
> > today. The routine is simple, always worked, but now I am getting an
error:
> > "Could not convert variant of type (string) into type (date)". I don't
know
> > where the string type gets into the picture. Anyone any ideas?
> >
> >       ContractObjecten.First;
> >       while not ContractObjecten.Eof do begin
> >         if (ContractObjecten['geannuleerd'] = null) or
> > (ContractObjecten['geannuleerd'] = '') then begin
> >           ContractObjecten.Edit;
> >           ContractObjecten['geannuleerd'] := DATE;
> >           ContractObjecten.Post;
> >         end;
> >         ContractObjecten.Next;
> >       end;
> >
> > Regards, Harry
> >
> >

Wed, May 2 2007 6:48 AMPermanent Link

"Harry de Boer"
Got it. In the onbeforepost someting changed that caused it!

Thanks.

"Harry de Boer" <harry@staaf.nl> schreef in bericht
news:E6A04B82-3706-404F-9731-24FA97549DFB@news.elevatesoft.com...
> LS,
>
> I encounter a very strange problem (never happend before) and I am
> scratching my head, pulling my hairs to figure it out. When a date field
is
> blank (or null) then that date field must be populated with the date of
> today. The routine is simple, always worked, but now I am getting an
error:
> "Could not convert variant of type (string) into type (date)". I don't
know
> where the string type gets into the picture. Anyone any ideas?
>
>       ContractObjecten.First;
>       while not ContractObjecten.Eof do begin
>         if (ContractObjecten['geannuleerd'] = null) or
> (ContractObjecten['geannuleerd'] = '') then begin
>           ContractObjecten.Edit;
>           ContractObjecten['geannuleerd'] := DATE;
>           ContractObjecten.Post;
>         end;
>         ContractObjecten.Next;
>       end;
>
> Regards, Harry
>
>

Image