By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,827 Members | 2,277 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,827 IT Pros & Developers. It's quick & easy.

Problem comparing date in MS Access and c#

100+
P: 153
Hi,
I am developing one application which requires me to compare date.The dataabse being MS access 2003.
When i execute the query in c# it does not show any record ,the date although matches with the date in database.
Where is the problem ?

The quey executed is

select * from finetable where fine_date=#1/9/2008 6:46:36 PM#
(The above date is entered by dateTimePicker)

The record which matches it being

serial_no fine_date reg_no fine_place
3 1/9/2008 6:44:55 PM 4521 india


Why it is not showing ??
Maybe coz the time is diff. But I want to compare dates only.

Please help me !
Aug 16 '08 #1
Share this Question
Share on Google+
2 Replies


Curtis Rutland
Expert 2.5K+
P: 3,256
Yeah, looks like your problem is that you're comparing different values.

I'm not sure off the top of my head how to compare only dates with Access syntax.

Since this is really an Access question, I'll move this thread over to our Access forum.
Aug 16 '08 #2

missinglinq
Expert 2.5K+
P: 3,532
Obviously, 1/9/2008 6:46:36 PM is never going to equal 1/9/2008 6:44:55 PM!

In Access VBA DateValue(YourDateTimeField) will return the date portion of a date/time field, so using this on both sides of the equation should give you the results you're looking for.

Linq ;0)>
Aug 16 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.