Get ready for BLACK FRIDAY shopping starting in

Forums

ASP

This topic is locked

Syntax error in INSERT INTO statement.

Posted 24 Jan 2004 15:53:06
1
has voted
24 Jan 2004 15:53:06 Glenn Bickford posted:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
/21Tricks/NewJustMessage.asp, line 135

I get the above error when trying to insert a new record in a database. I cannot for the life of me figure out where I am going wrong.. Here is the modified code of the standard Dreamweaver "Insert Record" funtion that I have..

MM_editQuery = "INSERT INTO ForumData(ID, User, date, " & MM_tableValues & " values ('" & TheID & "', '" & UsernameValue & "', '" & TheNow & "', " & MM_dbValues & ""

This is what came out if I do a reponse.write of the "MM_editQuery" query.


INSERT INTO ForumData(ID, User, date, Message) values ('48', ' ', '1/24/2004 3:44:42 PM', 'xgsgfdfg')

The fields in my Database are...

MessageID - Autonumber
ID - Text
User - Text
Date - Text
Message - Memo

Any help will be fantastic

Thanks
www.21tricks.com

Replies

Replied 26 Jan 2004 12:33:12
26 Jan 2004 12:33:12 Bob Back replied:
The column named <i><b>date</b></i> is causing your error. Rename it to something like 'mdate' and it will work.
Bob

Replied 26 Jan 2004 12:54:16
26 Jan 2004 12:54:16 Dave Thomas replied:
yep bob is right, you should look up "reserved words" in access databases, so you get better understanding of this.

basically access has "date" built in as a keyword to use in its own language, so with you calling your date field simply "date", access throws up all over you <img src=../images/dmxzone/forum/icon_smile_tongue.gif border=0 align=middle>

Regards,
Dave

[DWMX 2004]|[FlashMX 2004 Pro]|[Studio MX 2004]|[SQL]|[Access2000/2002]|[ASP/VBScript]|[XP-Pro]
If you like online gaming, please register @ www.nova-multigaming.com

Reply to this topic