Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INSERT INTO syntax error?

Status
Not open for further replies.

M4TT5T3R

Programmer
Apr 19, 2001
11
US
This exact same insert string has worked before, but now when I try to insert a record into a MS Access database, the script returns the error:
------------------------------------------------------------
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
------------------------------------------------------------
Here's the code that I'm having problems with:
------------------------------------------------------------
sSQL = "INSERT INTO Messages(ForumID, Author, Email, Date, Subject, Message, Original, IP) Values('" & frmTopic & "', '" & frmAuthor & "', '" & frmEmail & "', '" & frmDate & "', '" & frmSubject & "', '" & frmMessage & "', '" & frmOriginal & "', '" & frmIP & "')"
-----------------------------------------------------------


Anyone know what the problem could be? Thanks in advance
 
I am not that good with asp but I think the problem with your insert is the date field.
Trying writing the Date as [Date]. So it will be:

sSQL = "INSERT INTO Messages(ForumID, Author, Email, [Date], Subject, Message, Original, IP) Values('" & frmTopic & "', '" & frmAuthor & "', '" & frmEmail & "', '" & frmDate & "', '" & frmSubject & "', '" & frmMessage & "', '" & frmOriginal & "', '" & frmIP & "')"

 
Hi,
If the problem is still there ,then I think this is due to query that is ultimately build up after asp is executed. this problem may arise and sql may throw an error when a string that is passed as a query is not proper. This may happen when message or topic that user types contain a single quote you may replace it with two single quotes and they try out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top