Aaron's correct, which is why we've seen suggestions on the list to use 
AsDateTime, which sets the TParam.DataType to ftDate.

I'm not sure that using AsString and then setting the DataType will work 
correctly, but you can try.  Note, however, that some databases (Oracle, 
for instance) won't allow you to alter the DataType of a parameter directly 
(although this restriction might just come into play after the parameter 
has been used once - can't remember the exact restriction).

It's best to use AsApples and AsOranges rather than using AsApple and 
setting DataType to ftOrange.

Cheers.
                        BJ...

----------
From:   Aaron Scott-Boddendijk[SMTP:[EMAIL PROTECTED]]
Reply To:       [EMAIL PROTECTED]
Sent:   Friday, 5 February 1999 10:22
To:     Multiple recipients of list delphi
Subject:        Re: [DUG]:  SQL (again)

>If I hard code the string:
>where
>  S.Vessel = C.Object AND
>  S.Separator = "SP1" AND
>  C.MeasDate = "04/01/1998"
>every runs ok...  (well, the datas crap cause its using wrong data).


Here you haven't specified column types so the binding occurs on
the database side with no prior expectations.

>but if I use:
>where
>  S.Vessel = C.Object AND
>  S.Separator = :Separator AND
>  C.MeasDate = :MeasDate

>with the code:

>dm.Query.ParamByName('MeasDate').AsString :=
>FormatDateTime('mm/dd/yyyy',StartDate);

>the query doesn't open.  The parameter is defined as being a string in the
>params editor...
>Is there anything simple I'm missing here???


Here you are saying 'MeasDate' is a string... The database says no it isn't
it's a date... Try setting the the ParamType of MeasDate to ftDATE.  I'm
not certain that this will work though.  Note that .AsString sets the 
paramtype
to ftSTRING.

This is my limited understanding of how the parameter system works - 
anyone,
if I'm leading him astray yell now (or snigger quietly in a corner)...

--
Aaron Scott-Boddendijk
Jump Productions
(07) 838-3371 Voice
(07) 838-3372 Fax



---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to