Home > Archive > MS SQLCE > March 2006 > Error when comparing two datetime values in SQL Mobile 2005









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Error when comparing two datetime values in SQL Mobile 2005
Lonifasiko

2006-03-07, 9:24 am

I was running this query against SQL Mobile 2005 database:

select * from Appointment where Appointment.appointmentDate >= {0} AND
Appointment.appointmentDate <= {1}

I was using parameters in order to insert the two datetime values in
the SQLCeCommand object.

All was working perfect but suddenly application started to crash ad
giving "native" errors, that is, no exceptions were thrown, application
just was exiting with "native error". I just have generated a new
database model, but I haven't changed this table at all!
"appointmentDate" is a simple datetime column. If I query SQL Server
instead of SQL Mobile 2005, query returns desired rows. Therefore,
problem is related to SQL Mobile 2005.

If I only use "select * from Appointment where
Appointment.appointmentDate >= {0} " or
"select * from Appointment where Appointment.appointmentDate <= {0} ",
the query runs ok.

But seems like egine does not like two datetime values comparison, al
least sometimes.

I've switched my select to "between" and query runs ok now, but I
cannot explain what has hapenned with my "old select".

Any ideas? Has somebody suffered this misterious behaviour before?

Thanks in advance.

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com