webForumDet fria alternativet

Vad ar det jag missar?

ASP

11 svar · 264 visningar · startad av annesophie

Medlem sedan juni 20012 236 inlägg
Frågan#1

Jag far foljande felmeddelande pa "conn.execute(sql)" raden:

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

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

/evaluation/documents/evalcheck.asp, line 166

Sidan evalcheck.asp ser ut sa har:


<%
option explicit
response.buffer=true

dim conn
dim sql
dim rs

dim fname
dim lname
dim email
dim country

dim vicor1Qone
dim vicor1Qtwo
dim vicor1Qthree
dim vicor1Qfour

dim vicor2Qone
dim vicor2Qtwo
dim vicor2Qthree
dim vicor2Qfour

dim eos1Qone
dim eos1Qtwo
dim eos1Qthree
dim eos1Qfour

dim craftec1Qone
dim craftec1Qtwo
dim craftec1Qthree
dim craftec1Qfour

dim ault1Qone
dim ault1Qtwo
dim ault1Qthree
dim ault1Qfour

dim ault2Qone
dim ault2Qtwo
dim ault2Qthree
dim ault2Qfour

dim ault3Qone
dim ault3Qtwo
dim ault3Qthree
dim ault3Qfour

dim condor1Qone
dim condor1Qtwo
dim condor1Qthree
dim condor1Qfour

dim pbx1Qone
dim pbx1Qtwo
dim pbx1Qthree
dim pbx1Qfour

dim pbx2Qone
dim pbx2Qtwo
dim pbx2Qthree
dim pbx2Qfour

dim pbx3Qone
dim pbx3Qtwo
dim pbx3Qthree
dim pbx3Qfour
dim pbx3Qfive

dim pbx4Qone
dim pbxt4Qtwo
dim pbx4Qthree
dim pbx4Qfour

dim otherQone
dim otherQtwo

dim comments

fname=request.form("fname")
lname=request.form("lname")
email=request.form("email")
country=request.form("country")

vicor1Qone=request.form("vicor1Qone")
vicor1Qtwo=request.form("vicor1Qtwo")
vicor1Qthree=request.form("vicor1Qthree")
vicor1Qfour=request.form("vicor1Qfour")

vicor2Qone=request.form("vicor2Qone")
vicor2Qtwo=request.form("vicor2Qtwo")
vicor2Qthree=request.form("vicor2Qthree")
vicor2Qfour=request.form("vicor2Qfour")

eos1Qone=request.form("eos1Qone")
eos1Qtwo=request.form("eos1Qtwo")
eos1Qthree=request.form("eos1Qthree")
eos1Qfour=request.form("eos1Qfour")

craftec1Qone=request.form("craftec1Qone")
craftec1Qtwo=request.form("craftec1Qtwo")
craftec1Qthree=request.form("craftec1Qthree")
craftec1Qfour=request.form("craftec1Qfour")

ault1Qone=request.form("ault1Qone")
ault1Qtwo=request.form("ault1Qtwo")
ault1Qthree=request.form("ault1Qthree")
ault1Qfour=request.form("ault1Qfour")

ault2Qone=request.form("ault2Qone")
ault2Qtwo=request.form("ault2Qtwo")
ault2Qthree=request.form("ault2Qthree")
ault2Qfour=request.form("ault2Qfour")

ault3Qone=request.form("ault3Qone")
ault3Qtwo=request.form("ault3Qtwo")
ault3Qthree=request.form("ault3Qthree")
ault3Qfour=request.form("ault3Qfour")

condor1Qone=request.form("condor1Qone")
condor1Qtwo=request.form("condor1Qtwo")
condor1Qthree=request.form("condor1Qthree")
condor1Qfour=request.form("condor1Qfour")

pbx1Qone=request.form("pbx1Qone")
pbx1Qtwo=request.form("pbx1Qtwo")
pbx1Qthree=request.form("pbx1Qthree")
pbx1Qfour=request.form("pbx1Qfour")

pbx2Qone=request.form("pbx2Qone")
pbx2Qtwo=request.form("pbx2Qtwo")
pbx2Qthree=request.form("pbx2Qthree")
pbx2Qfour=request.form("pbx2Qfour")

pbx3Qone=request.form("pbx3Qone")
pbx3Qtwo=request.form("pbx3Qtwo")
pbx3Qthree=request.form("pbx3Qthree")
pbx3Qfour=request.form("pbx3Qfour")
pbx3Qfive=request.form("pbx3Qfive")

pbx4Qone=request.form("pbx4Qone")
pbxt4Qtwo=request.form("pbxt4Qtwo")
pbx4Qthree=request.form("pbx4Qthree")
pbx4Qfour=request.form("pbx4Qfour")

otherQone=request.form("otherQone")
otherQtwo=request.form("otherQtwo")

comments=request.form("comments")

%>

<!-- #INCLUDE FILE="koppling.asp" -->

<%

sql="INSERT INTO [eval] (fname, lname, email, country, vicor1Qone, vicor1Qtwo, vicor1Qthree, vicor1Qfour, vicor2Qone, vicor2Qtwo, vicor2Qthree, vicor2Qfour, eos1Qone, eos1Qtwo, eos1Qthree, eos1Qfour, craftec1Qone, craftec1Qtwo, craftec1Qthree, craftec1Qfour, ault1Qone, ault1Qtwo, ault1Qthree, ault1Qfour, ault2Qone, ault2Qtwo, ault2Qthree, ault2Qfour, ault3Qone, ault3Qtwo, ault3Qthree, ault3Qfour, condor1Qone, condor1Qtwo, condor1Qthree, condor1Qfour, pbx1Qone, pbx1Qtwo, pbx1Qthree, pbx1Qfour, pbx2Qone, pbx2Qtwo, pbx2Qthree, pbx2Qfour, pbx3Qone, pbx3Qtwo, pbx3Qthree, pbx3Qfour, pbx3Qfive, pbx4Qone, pbxt4Qtwo, pbx4Qthree, pbx4Qfour, otherQone, otherQtwo, comments) " &_
"VALUES ('"&fname&"','"&lname&"','"&email&"','"&country&"',"&vicor1Qone&","&vicor1Qtwo&","&vicor1Qthree&","&vicor1Qfour&","&vicor2Qone&","&vicor2Qtwo&","&vicor2Qthree&","&vicor2Qfour&","&eos1Qone&","&eos1Qtwo&","&eos1Qthree&","&eos1Qfour&","&craftec1Qone&","&craftec1Qtwo&","&craftec1Qthree&","&craftec1Qfour&","&ault1Qone&","&ault1Qtwo&","&ault1Qthree&","&ault1Qfour&","&ault2Qone&","&ault2Qtwo&","&ault2Qthree&","&ault2Qfour&","&ault3Qone&","&ault3Qtwo&","&ault3Qthree&","&ault3Qfour&","&condor1Qone&","&condor1Qtwo&","&condor1Qthree&","&condor1Qfour&","&pbx1Qone&","&pbx1Qtwo&","&pbx1Qthree&","&pbx1Qfour&","&pbx2Qone&","&pbx2Qtwo&","&pbx2Qthree&","&pbx2Qfour&","&pbx3Qone&","&pbx3Qtwo&","&pbx3Qthree&","&pbx3Qfour&","&pbx3Qfive&","&pbx4Qone&","&pbxt4Qtwo&","&pbx4Qthree&","&pbx4Qfour&","&otherQone&","&otherQtwo&",'"&comments&"');"
conn.execute(sql)
response.write sql

response.redirect("evaluation.html")
%>

Jag har dubbelkollat sa att alla falt stammer overens med vad som ska in..sa det ar inte det som ar fel. Jag kan inte skriva ut sql satsen, jJag har lagt in en check och den reagerar inte pa tomma falt alls sa jag tar for givet att det ar fel pa evalchecksidan nagonstans. Satte precis alla tabellfalt till not required som test i databasen men far fortfarande samma fel.

I min insert fick jag automatisk radbrytning da det var sa manga falt sa jag gjorde en "manuell" radbrytning precis innan VALUES...ar detta ratt?

Jag behover hjalp...please!

/A

Medlem sedan feb. 20016 388 inlägg
#2

Jag är lite osäker på om du verkligen ska ha fnuttar i slutet och i början av raden samt det sista semikolonet.
Borde det inte vara:

sql="INSERT INTO [eval] (fname, osv...) &_
VALUES (' " &fnamne& " ' osv) "
Medlem sedan juni 20012 236 inlägg
#3

Jo det maste jag nog for annars far jag:

Microsoft VBScript compilation error '800a0409'

Unterminated string constant

/evaluation/documents/evalcheck.asp, line 164

OBS! Jag kan inte se nagon text som ar satt mellan ['KOD] taggar av nagon anledning sa undvik garna dom i denna traden.

HEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEELP!!!

Medlem sedan feb. 20016 388 inlägg
#4

Funkar det om du inte gör radbrytning alls då?

Medlem sedan dec. 200012 464 inlägg
#5

Kan du lägga till en utskift av variabeln sql och visa resultatet.

response.write sql

Det kanske är någon av dina strängar som innehåller en ' eller något. För att skydda sig mot sådant (även av säkerhetsskäl) så måste man lägga till att man byter alla förekomster av ' till '' i sql-statement.

fname=replace(request.form("fname"),"'","''")
'och så vidare med övriga variabler

Medlem sedan feb. 20016 388 inlägg
#6

Testa att göra så här i så fall:

sql = "INSERT INTO [eval]"
sql = sql & "(fname, osv...)"
sql = sql & "VALUES (' " &fnamne& " ' osv... )"

Medlem sedan juni 20012 236 inlägg
#7

Om jag gor sa som Hypatia visar sa...

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

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

/evaluation/documents/evalcheck.asp, line 95

vilket ar: conn.execute(sql)

Sa har ser det ut nu:

<%

sql = "INSERT INTO [eval]"
sql = sql & "(fname, lname, email, country, vicor1Qone, vicor1Qtwo, vicor1Qthree, vicor1Qfour, vicor2Qone, vicor2Qtwo, vicor2Qthree, vicor2Qfour, eos1Qone, eos1Qtwo, eos1Qthree, eos1Qfour, craftec1Qone, craftec1Qtwo, craftec1Qthree, craftec1Qfour, ault1Qone, ault1Qtwo, ault1Qthree, ault1Qfour, ault2Qone, ault2Qtwo, ault2Qthree, ault2Qfour, ault3Qone, ault3Qtwo, ault3Qthree, ault3Qfour, condor1Qone, condor1Qtwo, condor1Qthree, condor1Qfour, pbx1Qone, pbx1Qtwo, pbx1Qthree, pbx1Qfour, pbx2Qone, pbx2Qtwo, pbx2Qthree, pbx2Qfour, pbx3Qone, pbx3Qtwo, pbx3Qthree, pbx3Qfour, pbx3Qfive, pbx4Qone, pbxt4Qtwo, pbx4Qthree, pbx4Qfour, otherQone, otherQtwo, comments)"
sql = sql & "VALUES ('"& fname &"', '"&lname&"' , '"&email&"' , '"&country&"' , "&vicor1Qone&" , "&vicor1Qtwo&" , "&vicor1Qthree&" , "&vicor1Qfour&" , "&vicor2Qone&" , "&vicor2Qtwo&" , "&vicor2Qthree&" , "&vicor2Qfour&" , "&eos1Qone&" , "&eos1Qtwo&" , "&eos1Qthree&" , "&eos1Qfour&" , "&craftec1Qone&" , "&craftec1Qtwo&" , "&craftec1Qthree&" , "&craftec1Qfour&" , "&ault1Qone&" , "&ault1Qtwo&" , "&ault1Qthree&" , "&ault1Qfour&","&ault2Qone&","&ault2Qtwo&","&ault2Qthree&","&ault2Qfour&","&ault3Qone&","&ault3Qtwo&","&ault3Qthree&","&ault3Qfour&","&condor1Qone&","&condor1Qtwo&","&condor1Qthree&","&condor1Qfour&","&pbx1Qone&","&pbx1Qtwo&","&pbx1Qthree&","&pbx1Qfour&","&pbx2Qone&","&pbx2Qtwo&","&pbx2Qthree&","&pbx2Qfour&","&pbx3Qone&","&pbx3Qtwo&","&pbx3Qthree&","&pbx3Qfour&","&pbx3Qfive&","&pbx4Qone&","&pbxt4Qtwo&","&pbx4Qthree&","&pbx4Qfour&","&otherQone&","&otherQtwo&",'"&comments&"' )"

conn.execute(sql)
response.write sql

Medlem sedan juni 20012 236 inlägg
#8

LarsG>

INSERT INTO [eval](fname, lname, email, country, vicor1Qone, vicor1Qtwo, vicor1Qthree, vicor1Qfour, vicor2Qone, vicor2Qtwo, vicor2Qthree, vicor2Qfour, eos1Qone, eos1Qtwo, eos1Qthree, eos1Qfour, craftec1Qone, craftec1Qtwo, craftec1Qthree, craftec1Qfour, ault1Qone, ault1Qtwo, ault1Qthree, ault1Qfour, ault2Qone, ault2Qtwo, ault2Qthree, ault2Qfour, ault3Qone, ault3Qtwo, ault3Qthree, ault3Qfour, condor1Qone, condor1Qtwo, condor1Qthree, condor1Qfour, pbx1Qone, pbx1Qtwo, pbx1Qthree, pbx1Qfour, pbx2Qone, pbx2Qtwo, pbx2Qthree, pbx2Qfour, pbx3Qone, pbx3Qtwo, pbx3Qthree, pbx3Qfour, pbx3Qfive, pbx4Qone, pbxt4Qtwo, pbx4Qthree, pbx4Qfour, otherQone, otherQtwo, comments)VALUES ('dasd', 'dasd' , 'dasd@dsad.se' , 'Denmark' , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,,2,2,1,2,'dsada' )
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

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

/evaluation/documents/evalcheck.asp, line 94

Hmmm ser ett tomt fat forresten!!!! Maste leta lite vad det kan vara...

Medlem sedan mars 20015 287 inlägg
#9

Red. lite sen där...

Medlem sedan juni 20012 236 inlägg
#10

Hmmm tror att jag har lost det...ett mellanslag hade tagit sig in i ett falt.

Jag aterkommer!

Medlem sedan juni 20012 236 inlägg
#11

Det funkade... :) Tack for hjalpen allihop! Skont att WF finns!

Medlem sedan mars 200125 inlägg
#12

Kör Trim(Request.Form("namn")) så slipper du mellanslag före å efter strängens början

626 ms totalt · 4 externa anrop · v20260731065814-full.a51de22e
150 ms — deklarationer (db)
0 ms — hämta statistik (cache)
473 ms — hämta tråd, inlägg och bilagor (db)
146 ms — ändringar (db)