Deadfunk
12-10-2004, 07:36 AM
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:
<%
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
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:
<%
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