Forums

ASP

This topic is locked

Date Format problem when using a DSN less connecti

Posted 22 Aug 2006 19:36:13
1
has voted
22 Aug 2006 19:36:13 Andy Cheshire posted:
Hi,

I recently converted the connection on my ASP (with Access 2000 database) website from a DSN connection to a DSN-less connection (the connection string is now Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\inetpub\databases\xxx\data.mdb<img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>

Everything works fine and is noticeably quicker but I have a problem with dates. In a couple of places I have hidden form fields which use &lt;%=Date()%&gt; to insert a "created on" or "last updated" date. These now write into the database as mm/dd/yyyy format (instead of dd/mm/yyyy format). I've tried all manner of formatting the date in the hidden field but the Access database still converts it to US format. I've also tried setting the LCID to 2057 on each page but that doesn't make any difference either.

If the date is after the 12th of the month then it inserts the correct date (as I guess it figures that 22/08/2006 can't refer to the 22nd month).

I've tried manually setting the format option in the Access database field to dd/mm/yyyy format but it still writes as mm/dd/yyyy.

I've checked my Regional Settings in my control panel and they're set for UK formats.

I've also got a couple of date pickers on the site and even after you pick the correct date (i.e. 04/08/2006 (4th Aug)) it still writes the wrong format to the database (i.e. 08/04/2006 (8th April)).

I'm really stuck with this one, I've tried everything I know but I can't get it work. I've now had to revert back to a DSN connection (the dates work perfectly with the DSN connection).

Can anybody help?

Replies

Replied 29 Sep 2007 22:06:03
29 Sep 2007 22:06:03 John Hardy replied:
I have exactly the same problem using CS3, perhaps this is one of the improvements

I am reverting back to MX2004. The other surprise in CS3 was that the repeat region has to be used in code view by selecting the &lt;tr tag. MX2004 works OK in Design view.

Another nasty I have just discovered is that CS3 seems not backwards compatible.

At least when I open a site in MX2004 which was created in CS3 all the recordsets are missing. Why did I buy CS3 when I was so happy with MX2004? Dont know!
JH
Replied 23 Oct 2007 00:11:36
23 Oct 2007 00:11:36 John Dixon replied:
I know it's been a while since this was posted, but I have a work around for this, listed at Codingforums www.codingforums.com/showthread.php?t=117190
and thought I'd post it here as well, just in case anyone is searching for ideas. It uses a small bit of VBScript and a small bit of hand coding change to the Dreamweaver server behaviours to insert or update a date into a table.

Edited by - dpages on 23 Oct 2007 00:13:54
Replied 23 Oct 2007 11:25:29
23 Oct 2007 11:25:29 John Hardy replied:
Thanks very much John Dixon fo the link to
www.codingforums.com/showthread.php?t=117190
This seems to solve the problem of the dates. I am disappointed that CS3 requires these modifications to the code whereas MX2004 never had such a problem.

I will post a link to this page at
www.dmxzone.com/forum/post.asp?method=Reply&topic_id=35929&forum_id=7&cat_id=5 where some other person may benefit from yours and others research.

Anyway Thanks again.
John


Reply to this topic