-
Does anyone see a syntax error in the following code? I keep getting the error.
ERROR--------------\/
Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement. /air/newforum/addnew.asp, line 66
CODE------------------\/
Application.Lock
sSQL = "INSERT INTO Message ( `From`, Email, Subject, Body, When, MsgLevel, PrevRef, ThreadPos, GroupName, Host ) " _
& "VALUES ('" & strFrom & "', '" & strEmail & "', '" & strSubject _
& "', '" & strBody &"', '" & CStr(Now()) & "', " & intNewMsgLevel _
& ", " & lngPrevRef & ", " & intNewThreadPos & ", '" & strGroup & "', '" &strHost &"');"
'Response.Write sSQL
db.Execute(sSQL) ***************line 66 ****************
ThreadIDQuery = "SELECT MAX(ID) AS LastMessage FROM Message"
Set MaxID = db.Execute(ThreadIDQuery)
LastMessage = MaxID("LastMessage")
If intThreadId = 0 Then
intThreadID = cint(LastMessage)
End If
IDUpdate = "UPDATE Message SET Message.ThreadID='" & intThreadID & "' Where ID="&LastMessage
db.Execute(IDUpdate)
Application.Unlock
-
Hi,
I do a lot of database programming in Cold Fusion for the WEB. I don't know if this will help, but this is how I would do it.
ssql= "INSERT INTO MESSAGES (From, Email, Subject, Body, When, MsgLevel, PrevRef, ThreadPos, GroupName, Host) VALUES (' "& strFrom & " ', ' " & strEmail & " ', ' " & strSubject & " ', ' " & strBody &" ', ' " & CStr(Now()) & " ', ' " & intNewMsgLevel & " ' , ' " & lngPrevRef & " ', ' " & intNewThreadPos & " ', ' " & strGroup & " ', ' " &strHost &" ');"
I put aa double spacing by the single/double quote combo so you could see them.
[Edited by winapi on 06-11-2000 at 05:56 PM]
-
you have remarked out this line:
'Response.Write sSQL
when you un-remark it, what do you get?
-
When you unmark it you get the same error
-
The code that was given seems a lot cleaner and i used it but i still get the same error. The network admin said that the obdc is turned off on the server but this is psrt of a message board and I can post to it just not reply that is the weird thing.
-
I meant when you unremark it, what is the SQL you get?
I want to see your SQL statement before it's sent to be processed
-
the statement is ok the obdc is just turned off and it is a fluke that the post worked.