Results 1 to 7 of 7

Thread: Insert Into - HELPPPPPPPPPPPPP

  1. #1

    Thread Starter
    Lively Member chongo 2002's Avatar
    Join Date
    Apr 2000
    Posts
    106
    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

  2. #2
    Member
    Join Date
    Aug 1999
    Location
    metairie, la usa
    Posts
    40
    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]

  3. #3
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    you have remarked out this line:

    'Response.Write sSQL

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

  4. #4

    Thread Starter
    Lively Member chongo 2002's Avatar
    Join Date
    Apr 2000
    Posts
    106
    When you unmark it you get the same error

  5. #5

    Thread Starter
    Lively Member chongo 2002's Avatar
    Join Date
    Apr 2000
    Posts
    106
    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.

  6. #6
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    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

  7. #7

    Thread Starter
    Lively Member chongo 2002's Avatar
    Join Date
    Apr 2000
    Posts
    106
    the statement is ok the obdc is just turned off and it is a fluke that the post worked.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width