i got this kind of error type:
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/wanhe/services/update_succeed.asp, line 80, column 129
sqlStrDB = "update applicant set Name='"&username&"', Gender= '"&gender&"', Age='"&age&"',Marriage='"&maritalstatus&"',HighEdu='"&hEducation&"',EngScore='"&engScore&"',ToeflScore='"&toeflScore&"',IeltsScore='"&ieltsScore&"',FysmScore='"&fysmScore&"',NcetScore='"&ncetScore&"',Tel='"&coTel&"',Mobile='"&coMobile&"',Email='"&coEmail&"',AppSchool='"&appSchool&"',AppMajor='"&appMajor&"',Comment='"&coComment&"',companyNameCN='"&coNameCN&"',companyNameEN='"&coNameEN&"',CoAddress='"&coAddress&"',CoPostal='"&coPostal&"' where ID = "&userID&""
this is my coding:
<%
dim cnStrDB
dim rcSetDB
dim sqlStrDB
'create connection and recordset objects
Set cnStrDB = Server.CreateObject("ADODB.Connection")
Set rcSetDB = Server.CreateObject("ADODB.Recordset")
' connection string
dim pathDB
dim providerDB
' change this path to your database path
pathDB = "C:\Inetpub\wwwroot\wanhe\services\oApplication.mdb "
providerDB = "Microsoft.Jet.OLEDB.4.0"
' defining database connection (connectionstring.asp)
cnStrDB.ConnectionString = pathDB
cnStrDB.Provider = providerDB
cnStrDB.Mode = 3
cnStrDB.open
dim username
Dim coNameCN
Dim coNameEN
Dim coAddress
Dim coPostal
dim gender
dim age
dim maritalstatus
dim hEducation
dim engScore
dim toeflScore
dim ieltsScore
dim fysmScore
dim ncetScore
dim appSchool
dim appMajor
Dim coTel
Dim userID
Dim coMobile
dim coEmail
dim coComment
username = request.form("userName")
coNameCN = request.form("txtCoNameCN")
coNameEN= request.form("txtCoNameEN")
coAddress= request.form("txtCoAddress")
coPostal= request.form("txtPostal")
coTel= request.form("Tel")
coMobile= request.form("Mobile")
coEmail= request.form("Email")
coComment= request.form("Comment")
gender= request.form("Gender")
age= request.form("Age")
maritalstatus= request.form("Age")
hEducation= request.form("highEdu")
'response.write hEducation
'response.end
engScore= request.form("EngScore")
toeflScore= request.form("ToeflScore")
ieltsScore= request.form("IeltsScore")
fysmScore= request.form("FysmScore")
ncetScore= request.form("NcetScore")
appSchool= request.form("AppSchool")
appMajor= request.form("AppMajor")
userID=Request.cookies("ID")
sqlStrDB = "update applicant set Name= '"&username&"', Gender= '"&gender&"', Age='"&age&"',Marriage='"&maritalstatus&"', HighEdu='"&hEducation&"', EngScore='"&engScore&"',ToeflScore='"&toeflScore&"',IeltsScore='"&ieltsScore&"',FysmScore='"&fysmScore&"',NcetScore='"&ncetScore&"',Tel='"&coTel&"',Mobile='"&coMobile&"',Email='"&coEmail&"',AppSchool='"&appSchool&"',AppMajor='"&appMajor&"',Comment='"&coComment&"',companyNameCN='"&coNameCN&"',companyNameEN='"&coNameEN&"',CoAddress='"&coAddress&"',CoPostal='"&coPostal&"' where ID = "&userID&""
rcSetDB.ActiveConnection = cnStrDB
rcSetDB.cursorType = 3 'for add record into database
rcSetDB.cursorLocation = 3
rcSetDB.open(sqlStrDB)
%>
i know it's somehting wrong with
HighEdu='"&hEducation&"
but i cant find where is wrong
anyone can helps me??
thanks a lot
:()Maybe that "" at the end should have been ";"?
You should really use prepared statements with bind variables. Not only do they improve performance and remove a security loophole, they also make it easier to write your SQL:
sqlStrDB = "update applicant set Name=?, Gender=?, Age=?,Marriage=?, HighEdu=?, ... , CoPostal=? where ID = ?;"|||same error message|||your first line:
sqlStrDB = "Your statement" _ (add the "_" at the end)
your second line:
& "Your statement" (add "&" at the first)
try to manipulate it if error happens again. I think it should work because you have to separate your string to another lines by these characters.
regards.
chris|||the problem is the variable name
i change to another name can liao
by the way thanks for ur help
Friday, March 9, 2012
Expected end of statement
Labels:
0x800a0401,
asp,
compilation,
database,
error,
expected,
line,
microsoft,
mysql,
oracle,
server,
services,
sql,
statement,
typeerror,
typemicrosoft,
update_succeed,
vbscript,
wanhe
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment