Python Community Server: Development

A weblog about programming in Python, C#, Java, Perl and C++ - and the occasional comment on PyCS development
new: discuss community servers on the CommunityServerWiki!

SunMonTueWedThuFriSat
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30

[ May ] [ Jul ]

the locals
also available in XML
Copyright (c) 2002 Phillip Pearson
spread the dot

2002-6-3

How do you query a Jet database by date in C#?

Apparently it's OK to say 'yyyy.MM.dd' in SQL, but I get an "exception of type 'System.Data.OleDb.OleDbException'" when I try it in C# with an Access DB.  Same for every other format I've tried.

It seems that inserting dates into MS SQL Server can be a fairly code-consuming process if you want to do it in Italian.  Is there a standard way to do this sort of thing?  Will always using the US format work?

MySQL seems to support the semi-standard yyyy-MM-dd format.  Does Access?

I'm writing code here in New Zealand that I don't want to blow up when someone somewhere else runs it.  Where is the official, 'safe' way to do it?!

(If anyone can find me the MS Jet version of this page, please drop me a line!)

For the moment I'm querying like this:

SELECT * FROM foo WHERE DAY(bar)=3 AND MONTH(bar)=6 AND YEAR(bar)=2002

It's not pretty, but it works.

Comment on this post [ so far]