webForumDet fria alternativet

Syntax fel

5 svar · 196 visningar · startad av aleborg

aleborgMedlem sedan jan. 20013 341 inlägg
#1

Kan inte hitta felet, är jag blind eller?
Syntaxfel i INSERT INTO-uttryck.

SQL = "Insert Into Design"
SQL = SQL & "(Title, Description, Keywords, InHead, Body, Bgcolor, Background, Text, Link, Vlink, Alink, Leftmargin, Topmargin, Marginwidth, Marginheight, TableWidth, TableBorder, TableSpacing, TablePadding, Head, Foot, Designname)"
SQL = SQL & "VALUES('"& Session("Title") &"', '"& Session("Description") &"', '"& Session("Keywords") &"', '"& Session("InHead") &"', '"& Session("Body") &"', '"& Session("Bgcolor") &"', '"& Session("Background") &"', '"& Session("Text") &"', '"& Session("Link") &"', '"& Session("Vlink") &"', '"& Session("Alink") &"', '"& Session("Leftmargin") &"', '"& Session("Topmargin") &"', '"& Session("Marginwidth") &"', '"& Session("Marginheight") &"', '"& Session("TableWidth") &"', '"& Session("TableBorder") &"', '"& Session("TableSpacing") &"', '"& Session("TablePadding") &"', '"& Session("Head") &"', '"& Session("Foot") &"', '"& Session("Designname") &"')"
Conn.Execute(SQL)

------------------
Data-Doktorn

VideMedlem sedan dec. 19998 577 inlägg
#2

Testa att skriva ut SQLsträngen innan du exekverar den... det blir lättare att se vad som är fel då:

SQL = "Insert Into Design"
SQL = SQL & "(Title, Description, Keywords, InHead, Body, Bgcolor, Background, Text, Link, Vlink, Alink, Leftmargin, Topmargin, Marginwidth, Marginheight, TableWidth, TableBorder, TableSpacing, TablePadding, Head, Foot, Designname)"
SQL = SQL & "VALUES('"& Session("Title") &"', '"& Session("Description") &"', '"& Session("Keywords") &"', '"& Session("InHead") &"', '"& Session("Body") &"', '"& Session("Bgcolor") &"', '"& Session("Background") &"', '"& Session("Text") &"', '"& Session("Link") &"', '"& Session("Vlink") &"', '"& Session("Alink") &"', '"& Session("Leftmargin") &"', '"& Session("Topmargin") &"', '"& Session("Marginwidth") &"', '"& Session("Marginheight") &"', '"& Session("TableWidth") &"', '"& Session("TableBorder") &"', '"& Session("TableSpacing") &"', '"& Session("TablePadding") &"', '"& Session("Head") &"', '"& Session("Foot") &"', '"& Session("Designname") &"')"
Response.Write SQL
Conn.Execute(SQL)

------------------
Budweiser - Slightly contaminated water... probably harmless, but I would recommend boiling before you drink it...
webEye.nu SweQuake.com

emissionMedlem sedan dec. 19996 721 inlägg
#3

SQL & " (

glöm inte mellanrummen

aleborgMedlem sedan jan. 20013 341 inlägg
#4
Insert Into Design (Title, Description, Keywords, InHead, Body, Bgcolor, Background, Text, Link, Vlink, Alink, Leftmargin, Topmargin, Marginwidth, Marginheight, TableWidth, TableBorder, TableSpacing, TablePadding, Head, Foot, Designname) VALUES ('Web', 'lösningar!', 'web', 'javascript ', 'testÖvrigt ', '#FFFFFF', 'Bakgrundsbild', '#000000', '#006699', '#0000ff', '#0000ff', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'Head:', 'foot', 'test')

------------------
Data-Doktorn

LarsGMedlem sedan dec. 200012 464 inlägg
#5

Text är ett reserverat ord i många SQL-dialekter, så du kanske skulle byta namn eller så.

Om du använder Access eller SQL server så kan du ange namnet inom [].

Om du använder en ANSI kompatibel DBMS så kan du ange namnet inom ""

------------------
essentitia preter non sans multiplicandum

aleborgMedlem sedan jan. 20013 341 inlägg
#6

Tack, glömde det :)

------------------
Data-Doktorn

141 ms totalt · 3 externa anrop · v20260731065814-full.86db40fa
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
139 ms — hämta tråd, inlägg och bilagor (db)