If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Expected end of statement

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-18-04, 04:08
sCruFyGal sCruFyGal is offline
Registered User
 
Join Date: Feb 2004
Posts: 4
Unhappy Expected end of statement

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&"',ToeflSco re='"&toeflScore&"',IeltsScore='"&ieltsScore&"',Fy smScore='"&fysmScore&"',NcetScore='"&ncetScore&"', Tel='"&coTel&"',Mobile='"&coMobile&"',Email='"&coE mail&"',AppSchool='"&appSchool&"',AppMajor='"&appM ajor&"',Comment='"&coComment&"',companyNameCN='"&c oNameCN&"',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.md b"
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='"&fysmSco re&"',NcetScore='"&ncetScore&"',Tel='"&coTel&"',Mo bile='"&coMobile&"',Email='"&coEmail&"',AppSchool= '"&appSchool&"',AppMajor='"&appMajor&"',Comment='" &coComment&"',companyNameCN='"&coNameCN&"',company NameEN='"&coNameEN&"',CoAddress='"&coAddress&"',Co Postal='"&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
)
Reply With Quote
  #2 (permalink)  
Old 02-18-04, 07:19
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
Re: Expected end of statement

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 = ?;"
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
  #3 (permalink)  
Old 02-18-04, 20:30
sCruFyGal sCruFyGal is offline
Registered User
 
Join Date: Feb 2004
Posts: 4
:(

same error message
Reply With Quote
  #4 (permalink)  
Old 02-18-04, 21:05
Christopher Christopher is offline
Registered User
 
Join Date: Jan 2004
Posts: 10
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
Reply With Quote
  #5 (permalink)  
Old 02-18-04, 21:18
sCruFyGal sCruFyGal is offline
Registered User
 
Join Date: Feb 2004
Posts: 4
i solve it le

the problem is the variable name
i change to another name can liao

by the way thanks for ur help
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On