PDA

Click to See Complete Forum and Search --> : Insert Into - HELPPPPPPPPPPPPP


chongo 2002
Jun 10th, 2000, 04:17 AM
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

winapi
Jun 11th, 2000, 04:53 AM
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]

Clunietp
Jun 12th, 2000, 05:13 AM
you have remarked out this line:

'Response.Write sSQL

when you un-remark it, what do you get?

chongo 2002
Jun 12th, 2000, 07:24 AM
When you unmark it you get the same error

chongo 2002
Jun 12th, 2000, 07:26 AM
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.

Clunietp
Jun 12th, 2000, 11:22 PM
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

chongo 2002
Jun 13th, 2000, 04:36 AM
the statement is ok the obdc is just turned off and it is a fluke that the post worked.