|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Poll
When I try the process a vote in my poll I receive the following message error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC Microsoft Access Driver] The INSERT INTO statement contains the following unknown field name: 'selection'. Make sure you have typed the name correctly, and try the operation again. /panteismo/pollwrite.asp, line 17 The pollwrite's code is: <% u_input=request.form("u_input") u_ip=request.servervariables("remote_addr") accessdb="/panteismo/db/poll.mdb" cn="driver={Microsoft Access Driver (*.mdb)};" cn=cn & "dbq=" & server.mappath(accessdb) set rs = server.createobject("ADODB.Recordset") set rs1= server.createobject("ADODB.Recordset") sql = "select ip from votos where ip ='" & u_ip & "'" rs.Open sql, cn if rs.eof then sql = "insert into votos (ip, selection" & u_input & ")" sql = sql & "values ('" & u_ip & "',1)" rs1.Open sql, cn response.redirect "pollresults.asp" else response.redirect "pollonce.html" end if %> "u_input" may be 01, 02, 03... 20 The vote will be added in the database by adding a "1! in the row selection"number_chosen". Donīt understand what is wrong... Can anyone help me to solve this problem? Thanks Luis |
|
#2
|
|||
|
|||
|
kill the part where you open the connection and response.write your sql statement, then post that, so we can see whats being fed into SQL Server.
Cheers, Justin Edit: perhaps that wasn't clear. comment out the connection, then response.write the sql string. post the sql string. Thx |
|
#3
|
|||
|
|||
|
Even better yet...
Read the error message: The INSERT INTO statement contains the following unknown field name: 'selection'.Make sure you have typed the name correctly, and try the operation again. This means that your INSERT INTO statement holds an unknown field name called 'selection', make sure you have typed the name correctly then retry your query. Or if you still don't understand then use jmiles's approach, make a Response.Write of your SQL Query *BEFORE* you execute it, also add a Response.End this way you won't be executing your query for nothing. Then copy/paste the results into Access/SQL Server and run it. Make sure the fields you ask for are correct. Hope this helps! Sincerely Vlince |
|
#4
|
|||
|
|||
|
Hi!
jmiles and Vlince, first of all thank you very much for your help. However, I must say that I'm new in asp and much of your help is misunderstood by me. Could you be a little bit more specific, please? I know that I donīt have a field called 'selection'... What I want is to introduce the vote on selection01 if choice is "01", selection02 if choice is 02, and so on... I presume that you already know that... I apologize for beeing so detailed... Thank you very much for advanced help Luis |
|
#5
|
|||
|
|||
|
Anyone... please...
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Poll |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|