By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,728 Members | 1,150 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,728 IT Pros & Developers. It's quick & easy.

correction d'une ligne de code

P: n/a
Bonjour,

Débutant en asp, mon navigateur me signale une faute dans cette ligne,
avec ces "" et ses '' je ne vois pas trop d'où viens l'erreur,
quelqu'un pourait-il m'aider? merci, pascal

La ligne est :

req_sql = UPDATE t_abo SET txtTransactionID=" &
request.form("txtTransactionID") & ", txtPayMet=" &
request.form('txtPayMet') & " WHERE ID=" & request('txtOrderIDShop')"
conn.Execute(req_sql)

----------------------------------------------------------------
Le code affiché par le navigateur est:

Microsoft VBScript compilation error '800a0401'

Expected end of statement

/e_confirmation_bd.asp, line 198

req_sql = UPDATE t_abo SET txtTransactionID=" &
request.form("txtTransactionID") & ", txtPayMet=" &
----------------------------^
request.form('txtPayMet') & " WHERE ID=" & request('txtOrderIDShop')"

Nov 9 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
elia wrote on 09 nov 2005 in microsoft.public.inetserver.asp.general:
req_sql = UPDATE t_abo SET txtTransactionID=" &
req_sql = "UPDATE t_abo SET txtTransactionID='" &_
request.form("txtTransactionID") & ", txtPayMet=" &
request.form("txtTransactionID") & "', txtPayMet='" &_
request.form('txtPayMet') & " WHERE ID=" & request('txtOrderIDShop')"
request.form("txtPayMet") & "' WHERE ID=" & request("txtOrderIDShop")
conn.Execute(req_sql)


conn.Execute req_sql

NB if: ID: number, txtPayMet: string, txtTransactionID: string

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Nov 9 '05 #2

P: n/a
You don't start your string with a ".

req_sql = UPDATE t_abo SET...."
vs.
req_sql = "UPDATE t_abo SET...."
Also, what's with request.form('txtPayMet') instead of
request.form("txtPayMet")?

Additionally:
http://www.google.com/search?hl=en&l...+sql+injection
http://www.aspfaq.com/show.asp?id=2111
Ray at work

"elia" <jo****@pcl.ch> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Bonjour,

Débutant en asp, mon navigateur me signale une faute dans cette ligne,
avec ces "" et ses '' je ne vois pas trop d'où viens l'erreur,
quelqu'un pourait-il m'aider? merci, pascal

La ligne est :

req_sql = UPDATE t_abo SET txtTransactionID=" &
request.form("txtTransactionID") & ", txtPayMet=" &
request.form('txtPayMet') & " WHERE ID=" & request('txtOrderIDShop')"
conn.Execute(req_sql)

----------------------------------------------------------------
Le code affiché par le navigateur est:

Microsoft VBScript compilation error '800a0401'

Expected end of statement

/e_confirmation_bd.asp, line 198

req_sql = UPDATE t_abo SET txtTransactionID=" &
request.form("txtTransactionID") & ", txtPayMet=" &
----------------------------^
request.form('txtPayMet') & " WHERE ID=" & request('txtOrderIDShop')"
Nov 9 '05 #3

P: n/a
Merci pour ces informations mais je n'y arrive toujours pas.
Le code comprends 3 imbrications, et donc " et ' ne suffisent pas!
J'ai essayé avec [ mais cela ne fonctionne pas non plus.
Mon probleme est d'ajouter deux variables (txtTransactionID ,
txtPayMet) pour un ID (txtOrderIDShop) qui proviennent d'un Post dans
une Base de donnée.

Ma ligne de code est maintenant :
req_sql = [UPDATE t_abo SET txtTransactionID=" &
request.form('txtTransactionID') &
", & txtPayMet=" & request.form('txtPayMet') " &
WHERE ID=" & request('txtOrderIDShop')"]

mais je reçois le message d'eureur suivant:
Microsoft OLE DB Provider for ODBC Drivers error '80040e0c'
Command text was not set for the command object.

merci.

Nov 10 '05 #4

P: n/a
elia wrote on 10 nov 2005 in microsoft.public.inetserver.asp.general:
req_sql = [UPDATE t_abo SET txtTransactionID=" &


Wrong, a string litteral should start with a "

req_sql = "UPDATE t_abo SET txtTransactionID="

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Nov 10 '05 #5

P: n/a
Ok, je commence avec :
"update ....
mais après je suis embêter, comment faire 3 imbrications??

" ......'.....?.....?.....'....."

merci

Nov 10 '05 #6

P: n/a
elia wrote on 10 nov 2005 in microsoft.public.inetserver.asp.general:
Ok, je commence avec :
"update ....
mais aprŠs je suis embˆter, comment faire 3 imbrications??

" ......'.....?.....?.....'....."

merci


ASP-vbs needs ".. anything ...." as a litteral string

varNumber = 3
varString = ".. anything ...." & 3 & ".. anything ...."

SQL needs internal! string litterals in '...',
but the string itself needs the ASP-vbs "..." external

varNumber = 17
myTable = "TblFirst"
sqlString = "delete '" & myTable "' where id = " & varNumber

This will make a string in sqlString:

"delete 'TblFirst' where id = 17"

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Nov 10 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Browse more ASP / Active Server Pages Questions on Bytes