Happy Day.

Note that parameters and fields behave differently for date types. 
 TParam.AsString expects the date in whatever date format is native to your 
database (e.g. Oracle's 'DD-MON-YY' format).  However, TField.AsString will 
show you the date in whatever format has been selected as your preference 
in Win95/NT.

To be safe, try and do all of your work as TDateTime until you absolutely 
need to go to strings.

Cheers.
                        BJ...

----------
From:   Derricutt, Mark[SMTP:[EMAIL PROTECTED]]
Reply To:       [EMAIL PROTECTED]
Sent:   Thursday, 4 February 1999 11:21
To:     Multiple recipients of list delphi
Subject:        [DUG]:  SQL/TQuery Problem...

<<File: Derricutt, Mark.vcf>>
Hi, got a date problem with TQueries....  I have this little bit of code:

    dm.Query.ParamByName('Separator').AsString := AObject;
    dm.Query.ParamByName('MeasDate').AsDateTime := StartDate;
    dm.st.Lines.Text := dm.Query.Text;
    dm.st.Edit;

dm.st.Edit gives me a form/memo with the contents of lines in it, which
shows:

select
  S.ConfigurationID,
  S.Separator,
  S.Vessel,
  S."Order",
  C.MeasDate,
  C.BrineFlow,
  C.SteamFlow,
  C.MassFlow,
  C.Enthalpy,
  C.Pressure,
  C.Temperature
from
  Separator S, CalcData C
where
  S.Vessel = C.Object AND
  S.Separator = ? AND
  C.MeasDate = ?

The ?'s in the last two lines WERE :Separator and :MeasDate respectively, 
is
it natural for them to be represented as ?'s????  Or is this what is
actually getting passed to the query...

The reason I ask is that for somereason the queries are now failing and not
returning any data, this is as far as I can tell, due to wrong date formats
being put in the SQL, however, I'm assigning the parameter via .AsDateTime
which I would have thought would work around those date inconsistancy
problems....

Any thoughts/ideas/suggestions or darn it - out-right solutions?

Mark


--
Mark Derricutt, Software Engineer
PB Power (NZ) Ltd



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

Reply via email to