Avatar billede Slettet bruger
20. marts 2002 - 13:09 Der er 4 kommentarer og
1 løsning

Fejl i SQL?

Jeg får følgende fejl ved nedenstående SQL:


INSERT INTO invoice (userid,name,address,zipcode,city,country,date,paymentId,sessionId) VALUES ('1','Per Jørgensen','Gyngevej 17','8520','Århus','Danmark','20-03-2002','4','38238344')

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

[Microsoft][ODBC Microsoft Access-driver] Der er en syntaksfejl i INSERT INTO-sætningen.

/emb.dk/www/includes/inc_global.asp, line 21


Selve SQL'en ser sådan ud:

    strSQLInvoice = "INSERT INTO invoice "
        strSQLInvoice = strSQLInvoice & "(userid,name,address,zipcode,city,country,date,paymentId,sessionId) VALUES ("
        strSQLInvoice = strSQLInvoice & "'" & Session("UserId") & "',"
        strSQLInvoice = strSQLInvoice & "'" & RS("name") & "',"
        strSQLInvoice = strSQLInvoice & "'" & RS("address") & "',"
        strSQLInvoice = strSQLInvoice & "'" & RS("zipcode") & "',"
        strSQLInvoice = strSQLInvoice & "'" & RS("city") & "',"
        strSQLInvoice = strSQLInvoice & "'" & RS("country") & "',"
        strSQLInvoice = strSQLInvoice & "'" & Date() & "',"
        strSQLInvoice = strSQLInvoice & "'" & Request.Querystring("payment") & "',"
        strSQLInvoice = strSQLInvoice & "'" & Session.SessionId & "'"
        strSQLInvoice = strSQLInvoice & ")"
Avatar billede rou Nybegynder
20. marts 2002 - 13:14 #1
Hmm, det kan være flere ting.. har du checket stavning af feltnavne? Hvad med de 3 ID felter og ZIPCODE, er det strings?
Avatar billede netsrac Praktikant
20. marts 2002 - 13:16 #2
Date er et reserveret SQL udtryk, kald dit felt noget andet eller brug [date] istedet for date
Avatar billede Slettet bruger
20. marts 2002 - 13:29 #3
Bingo :) Tak NetsRac
Avatar billede netsrac Praktikant
20. marts 2002 - 13:30 #4
Så lidt :)
Avatar billede cthun Nybegynder
20. marts 2002 - 13:31 #5
strSQLInvoice = "INSERT INTO invoice "
        strSQLInvoice = strSQLInvoice & "(userid,name,address,zipcode,city,country,date,paymentId,sessionId) VALUES ("
        strSQLInvoice = strSQLInvoice & Session("UserId") & ","
        strSQLInvoice = strSQLInvoice & "'" & RS("name") & "',"
        strSQLInvoice = strSQLInvoice & "'" & RS("address") & "',"
        strSQLInvoice = strSQLInvoice & "'" & RS("zipcode") & "',"
        strSQLInvoice = strSQLInvoice & "'" & RS("city") & "',"
        strSQLInvoice = strSQLInvoice & "'" & RS("country") & "',"
        strSQLInvoice = strSQLInvoice & "'" & Date() & "',"
        strSQLInvoice = strSQLInvoice & "'" & Request.Querystring("payment") & "',"
        strSQLInvoice = strSQLInvoice & "'" & Session.SessionId & "'"
        strSQLInvoice = strSQLInvoice & ")"
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester