Board index » delphi » Q: Comparing datetime Field

Q: Comparing datetime Field

I'm using Delphi Client/Server 2.01 and MS SQL Server 6.5.

What's the proper way to compare a timestamp field (type datetime) when
performing an update?

I have a stored procedure set up to do an update, followed by something
like "where name=@name and edt_dt=@edt_dt", but the datetime field
comparison always fails, and the update is never performed.  What's the
proper way to read in the initial value of the timestamp field and then
pass it to the stored procedure?  I currently just store it into a
TDateTime variable by setting it equal to
qryTest.FieldByName('edt_dt').AsDateTime and then setting the parameter
in the stored procedure to this value, but this never works.

Any help would be greatly appreciated.  Thanks.

 

Re:Q: Comparing datetime Field


Quote
Son of Westwood wrote:
> I'm using Delphi Client/Server 2.01 and MS SQL Server 6.5.

> What's the proper way to compare a timestamp field (type datetime)
> when
> performing an update?

> I have a stored procedure set up to do an update, followed by
> something
> like "where name=@name and edt_dt=@edt_dt", but the datetime field
> comparison always fails, and the update is never performed.  What's
> the
> proper way to read in the initial value of the timestamp field and
> then
> pass it to the stored procedure?  I currently just store it into a
> TDateTime variable by setting it equal to
> qryTest.FieldByName('edt_dt').AsDateTime and then setting the
> parameter
> in the stored procedure to this value, but this never works.

> Any help would be greatly appreciated.  Thanks.

I had a similar problem in my last project.
Seems to be that DateTime format of database differs from Delphi's.
I also discovered that those formats additionaly depend on the
Win95-language
(in my case German).
My solution:
Dont use TimestampType in Database. Use Number instead.
(TDateTime is actualy of Type Double)

Volker

Other Threads