Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004

    Unhappy Unanswered: 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\ b"
    providerDB = "Microsoft.Jet.OLEDB.4.0"

    ' defining database connection (connectionstring.asp)
    cnStrDB.ConnectionString = pathDB
    cnStrDB.Provider = providerDB
    cnStrDB.Mode = 3
    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
    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")


    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


    i know it's somehting wrong with
    but i cant find where is wrong

    anyone can helps me??
    thanks a lot

  2. #2
    Join Date
    Sep 2002
    Provided Answers: 1

    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 = ?;"

  3. #3
    Join Date
    Feb 2004


    same error message

  4. #4
    Join Date
    Jan 2004
    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.



  5. #5
    Join Date
    Feb 2004

    i solve it le

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

    by the way thanks for ur help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts