/ Forside / Teknologi / Udvikling / ASP / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
ASP
#NavnPoint
smorch 9259
Harlekin 1866
molokyle 1040
Steffanst.. 758
gandalf 657
smilly 564
gibson 560
cumano 530
MouseKeep.. 480
10  Random 410
Stor sql linie og sikkert en lille fejl
Fra : Matthiaz


Dato : 24-03-04 19:58

Hej, og på forhånd tak.


##En rimelig stor sql, og kan ikke se fejlen. :(

strUNavn = Request.Cookies("REaction")("id")
Dim strSQL

strSQL = "UPDATE members set ("
strSQL = strSQL & "name, "
strSQL = strSQL & "brugernavn, "
strSQL = strSQL & "age, "
strSQL = strSQL & "country, "
strSQL = strSQL & "town, "
strSQL = strSQL & "email, "
strSQL = strSQL & "sort, "
strSQL = strSQL & "division, "
strSQL = strSQL & "homepage, "
strSQL = strSQL & "quote, "
strSQL = strSQL & "rank, "
strSQL = strSQL & "cpu, "
strSQL = strSQL & "monitor, "
strSQL = strSQL & "gfx, "
strSQL = strSQL & "headset, "
strSQL = strSQL & "gamepad, "
strSQL = strSQL & "connection, "
strSQL = strSQL & "software, "
strSQL = strSQL & "sens, "
strSQL = strSQL & "addcompinfo, "
strSQL = strSQL & "beskrivelse, "
strSQL = strSQL & "news, "
strSQL = strSQL & "password"
strSQL = strSQL & " Where Id = " & strUNavn & ""
strSQL = strSQL & ") VALUES ("
strSQL = strSQL & "'" & Replace(Request.Form("name"), "'", "''") & "', "
strSQL = strSQL & "'" & Replace(Request.Form("brugernavn"), "'", "''") & "',
"
strSQL = strSQL & "'" & Replace(Request.Form("age"), "'", "''") & "', "
strSQL = strSQL & "'" & Replace(Request.Form("country"), "'", "''") & "', "
strSQL = strSQL & "'" & Replace(Request.Form("town"), "'", "''") & "', "
strSQL = strSQL & "'" & Replace(Request.Form("email"), "'", "''") & "', "
strSQL = strSQL & "'" & Replace(Request.Form("sort"), "'", "''") & "', "
strSQL = strSQL & "'" & Replace(Request.Form("division"), "'", "''") & "', "
strSQL = strSQL & "'" & Replace(Request.Form("homepage"), "'", "''") & "', "
strSQL = strSQL & "'" & Replace(Request.Form("quote"), "'", "''") & "', "
strSQL = strSQL & "'" & Replace(Request.Form("rank"), "'", "''") & "', "
strSQL = strSQL & "'" & Replace(Request.Form("cpu"), "'", "''") & "', "
strSQL = strSQL & "'" & Replace(Request.Form("monitor"), "'", "''") & "', "
strSQL = strSQL & "'" & Replace(Request.Form("gfx"), "'", "''") & "', "
strSQL = strSQL & "'" & Replace(Request.Form("headset"), "'", "''") & "', "
strSQL = strSQL & "'" & Replace(Request.Form("gamepad"), "'", "''") & "', "
strSQL = strSQL & "'" & Replace(Request.Form("connection"), "'", "''") & "',
"
strSQL = strSQL & "'" & Replace(Request.Form("software"), "'", "''") & "', "
strSQL = strSQL & "'" & Replace(Request.Form("sens"), "'", "''") & "', "
strSQL = strSQL & "'" & Replace(Request.Form("addcompinfo"), "'", "''") &
"', "
strSQL = strSQL & "'" & Replace(Request.Form("beskrivelse"), "'", "''") &
"', "
strSQL = strSQL & "'" & Replace(Request.Form("news"), "'", "''") & "', "
strSQL = strSQL & "'" & Replace(Request.Form("password"), "'", "''") & "')"

myConn.Execute strSQL

##får følgende fejl meddelelse:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
/retaliant/user_update.asp, line 303


Tak

, Matthiaz H.



 
 
finn elmgaard (24-03-2004)
Kommentar
Fra : finn elmgaard


Dato : 24-03-04 20:57


"Matthiaz" <Matthias @warpmedia.com> wrote in message
news:c3slms$dvk$1@sunsite.dk...
> Hej, og på forhånd tak.
>
>
> ##En rimelig stor sql, og kan ikke se fejlen. :(
>
> strUNavn = Request.Cookies("REaction")("id")
> Dim strSQL
>
> strSQL = "UPDATE members set ("
> strSQL = strSQL & "name, "
> strSQL = strSQL & "brugernavn, "
> strSQL = strSQL & "age, "
> strSQL = strSQL & "country, "
> strSQL = strSQL & "town, "
> strSQL = strSQL & "email, "
> strSQL = strSQL & "sort, "
> strSQL = strSQL & "division, "
> strSQL = strSQL & "homepage, "
> strSQL = strSQL & "quote, "
> strSQL = strSQL & "rank, "
> strSQL = strSQL & "cpu, "
> strSQL = strSQL & "monitor, "
> strSQL = strSQL & "gfx, "
> strSQL = strSQL & "headset, "
> strSQL = strSQL & "gamepad, "
> strSQL = strSQL & "connection, "
> strSQL = strSQL & "software, "
> strSQL = strSQL & "sens, "
> strSQL = strSQL & "addcompinfo, "
> strSQL = strSQL & "beskrivelse, "
> strSQL = strSQL & "news, "
> strSQL = strSQL & "password"
> strSQL = strSQL & " Where Id = " & strUNavn & ""
> strSQL = strSQL & ") VALUES ("
> strSQL = strSQL & "'" & Replace(Request.Form("name"), "'", "''") & "', "
> strSQL = strSQL & "'" & Replace(Request.Form("brugernavn"), "'", "''") &
"',
> "
> strSQL = strSQL & "'" & Replace(Request.Form("age"), "'", "''") & "', "
> strSQL = strSQL & "'" & Replace(Request.Form("country"), "'", "''") & "',
"
> strSQL = strSQL & "'" & Replace(Request.Form("town"), "'", "''") & "', "
> strSQL = strSQL & "'" & Replace(Request.Form("email"), "'", "''") & "', "
> strSQL = strSQL & "'" & Replace(Request.Form("sort"), "'", "''") & "', "
> strSQL = strSQL & "'" & Replace(Request.Form("division"), "'", "''") & "',
"
> strSQL = strSQL & "'" & Replace(Request.Form("homepage"), "'", "''") & "',
"
> strSQL = strSQL & "'" & Replace(Request.Form("quote"), "'", "''") & "', "
> strSQL = strSQL & "'" & Replace(Request.Form("rank"), "'", "''") & "', "
> strSQL = strSQL & "'" & Replace(Request.Form("cpu"), "'", "''") & "', "
> strSQL = strSQL & "'" & Replace(Request.Form("monitor"), "'", "''") & "',
"
> strSQL = strSQL & "'" & Replace(Request.Form("gfx"), "'", "''") & "', "
> strSQL = strSQL & "'" & Replace(Request.Form("headset"), "'", "''") & "',
"
> strSQL = strSQL & "'" & Replace(Request.Form("gamepad"), "'", "''") & "',
"
> strSQL = strSQL & "'" & Replace(Request.Form("connection"), "'", "''") &
"',
> "
> strSQL = strSQL & "'" & Replace(Request.Form("software"), "'", "''") & "',
"
> strSQL = strSQL & "'" & Replace(Request.Form("sens"), "'", "''") & "', "
> strSQL = strSQL & "'" & Replace(Request.Form("addcompinfo"), "'", "''") &
> "', "
> strSQL = strSQL & "'" & Replace(Request.Form("beskrivelse"), "'", "''") &
> "', "
> strSQL = strSQL & "'" & Replace(Request.Form("news"), "'", "''") & "', "
> strSQL = strSQL & "'" & Replace(Request.Form("password"), "'", "''") &
"')"
>
> myConn.Execute strSQL
>
> ##får følgende fejl meddelelse:
> Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
> [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE
statement.
> /retaliant/user_update.asp, line 303


Jeg tror du sammenblander UPDATE og INSERT SQL statements:

UPDATE table_name
SET column_name = new_value
WHERE column_name = some_value

INSERT INTO table_name
VALUES (value1, value2,....



mvh
Finn




Jens Gyldenkærne Cla~ (24-03-2004)
Kommentar
Fra : Jens Gyldenkærne Cla~


Dato : 24-03-04 22:57

Matthiaz skrev:

> ##En rimelig stor sql, og kan ikke se fejlen. :(

Det gyldne svar ved problemer med sql-sætninger: Udskriv din sql-
variabel. Hver gang. Hver eneste gang.

Du kan se hvordan det gøres her: <http://asp-faq.dk/article/?id=41>

> strSQL = "UPDATE members set ("

Som Finn også er inde på blander du UPDATE- og INSERT-syntaks.

Hvis du vil oprette en ny post, skal du bruge INSERT. Her angives
først en feltliste og dernæst en værdiliste.

Hvis du vil opdatere en eksisterende post, skal du bruge UPDATE.
Her angives feltnavn og ny værdi parvis for alle de felter der skal
opdateres.

Syntaksen for såvel INSERT som UPDATE er gennemgået i html.dk's
asp-tutorial <http://html.dk/tutorials/asp/>.
--
Jens Gyldenkærne Clausen
Svar venligst under det du citerer, og citer kun det der er
nødvendigt for at forstå dit svar i sammenhængen. Se hvorfor og
hvordan på http://usenet.dk/netikette/citatteknik.html

Søg
Reklame
Statistik
Spørgsmål : 177501
Tips : 31968
Nyheder : 719565
Indlæg : 6408527
Brugere : 218887

Månedens bedste
Årets bedste
Sidste års bedste