Print Page | Close Window

Date problem

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=4522
Printed Date: 30 March 2026 at 10:10am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Date problem
Posted By: jsebastien
Subject: Date problem
Date Posted: 25 July 2003 at 8:13am
Here is my problem. I have the following code (JSCRIPT).

var date_aujourdhui = new Date();
...
Insertion_Commentaire = oConn.execute("INSERT INTO T_Commentaires (Date_Commentaire, CE_Membre, Commentaire, CE_No_Photo) VALUES (" + date_aujourdhui + "," + num_diplome + ",'" + nouveau_commentaire + "'," + num_photo + ")");
Response.write("Votre commentaire a bel et bien été ajouté." + date_aujourdhui);

The Date_Commentaire field is a date field but I get the following error :

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Fri Jul 25 09:46:52 2003'.

/dev/insertion_commentaire_2.asp, line 24

Can you help me?



Replies:
Posted By: Mart
Date Posted: 28 July 2003 at 4:45am
I don't think many people use JSCRIPT in this forum...


Posted By: Bunce
Date Posted: 28 July 2003 at 6:45am

Dates in Access need to be surrounded by ##, so try something like:

.. VALUES (#" + date_today + "#," + ....

(he he - love my French  )

Cheers,
Andrew



-------------
There have been many, many posts made throughout the world...
This was one of them.


Posted By: jsebastien
Date Posted: 28 July 2003 at 7:01pm
thanks a lot bunce! I found the answer to my problem on another website but you are 100% right!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net