Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Final thesis (somethings wrong with my questionnaire)

    I'm currently working on my final degree thesis, and I don't have much time left. Needles to say I’m panicking. I'm trying to do a questionnaire on the net, but I can't get it to work. There's something wrong with my coding.

    This forum is probably my last hope.

    Anyway, the error message I get looks like this:

    "Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

    [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.

    /sajberstudent/survey3.asp, line 24"



    And my code looks like this:


    Code:
    <%
    Dim con, cm
    
    Set con = Server.CreateObject("ADODB.Connection")
    Set cm = Server.CreateObject("ADODB.Command")
    
    DSNName = "DRIVER=Microsoft Access Driver (*.mdb);DBQ="
    DSNName = DSNName & Server.MapPath("/sajberstudent/database/data.mdb")
    con.Open DSNName
    Set cm.activeconnection = con
    
    sql = "INSERT INTO Survey (1a, 1b, 1c, 2, 3, 4, 5, 6, 7, 8, 9a, 9b, 9c, 9d, 10, 11a, 11b, 12, 13, 14a, 14b, 14c, 15, " &_
    		  "16a, 16b, 17a, 17b, 17c, 18a, 18b, 18c, 19, 20, 21, 22, 23, 24a, 24b, 25, 26, 27, 28, 29, 30, 31, 32) VALUES " &_
    			"("&request.form("1a")&", "&request.form("1b")&", "&request.form("1c")&", "&request.form("2")&", "&request.form("3")&", "&request.form("4")&"," &_
    			" "&request.form("5")&", "&request.form("6")&", "&request.form("7")&", "&request.form("8")&", "&request.form("9a")&", "&request.form("9b")&"," &_
    			" "&request.form("9c")&", "&request.form("9d")&", '"&request.form("10")&"', '"&request.form("11a")&"', '"&request.form("11b")&"', "&request.form("12")&"," &_
    			" "&request.form("13")&", "&request.form("14a")&", "&request.form("14b")&", "&request.form("14c")&", "&request.form("15")&", '"&request.form("16a")&"'," &_
    			" '"&request.form("16b")&"', "&request.form("17a")&", "&request.form("17b")&", "&request.form("17c")&", '"&request.form("18a")&"', '"&request.form("18b")&"'," &_
    			" '"&request.form("18c")&"', "&request.form("19")&", "&request.form("20")&", "&request.form("21")&", "&request.form("22")&", "&request.form("23")&"," &_
    			" '"&request.form("24a")&"', '"&request.form("24b")&"', "&request.form("25")&", "&request.form("26")&", '"&request.form("27")&"', "&request.form("28")&"," &_
    			" "&request.form("29")&", "&request.form("30")&", "&request.form("31")&", "&request.form("32")&")"
    			
    cm.commandtext = sql
    cm.execute
    con.Close
    response.write ("Tack för din medverkan. Om du vill ta del av resultatet kan du maila mig på adressen sajberstudent@hotmail.com")
    %>

    I’ve tried to add a response.write (sql) and I then get the following reply:

    INSERT INTO Survey (1a, 1b, 1c, 2, 3, 4, 5, 6, 7, 8, 9a, 9b, 9c, 9d, 10, 11a, 11b, 12, 13, 14a, 14b, 14c, 15, 16a, 16b, 17a, 17b, 17c, 18a, 18b, 18c, 19, 20, 21, 22, 23, 24a, 24b, 25, 26, 27, 28, 29, 30, 31, 32) VALUES (7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 'bla', 'bla', 'bla', 1, 7, 7, 7, 7, 7, 'bla', 'bla', 7, 7, 7, 'bla', 'bla', 'bla', 7, 7, 7, 7, 7, 'bla', 'bla', 7, 2, '23', 4, 2, 3, 2, 2)

    To test the database I added the information to the database with the help of a sql-question. I didn't get any error messages, which should mean that there's nothing wrong with the database, right?

    Please help me, please. My degree hangs on this survey, if I fail...

    I don't know what to do...

    Regards

    Magnus "Deadfunk" Gustafsson

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Zwolle, The Netherlands
    Posts
    1,120
    Thanks
    2
    Thanked 31 Times in 31 Posts
    instead of this:
    Code:
    cm.commandtext = sql
    cm.execute
    try this:
    Code:
    con.Execute sql
    or perhaps the numbers in the column-names are the problem, try to surround them with [], like

    INSERT INTO table ([1],[2],[3],....)
    Last edited by Roelf; 12-10-2004 at 10:28 AM.
    I am the luckiest man in the world

  • #3
    New to the CF scene
    Join Date
    Dec 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't know why, but your suggestion works. Your my hero, you’re a “super code man” But seriously, I don't think you can begin to understand how grateful I am, I almost got tears in my eyes when I saw that the thing worked.

    God be with you Roelf

    Magnus "Deadfunk" Gustafsson


  •  

    Posting Permissions

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