Syntax error in UPDATE statement.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phuc2583
    New Member
    • Dec 2007
    • 18

    Syntax error in UPDATE statement.

    I don't think my code get to error;
    please check the code for me
    i have found but i can see where error was
    this is my code UPDATE:
    if trim(request("O ption"))="EditC ustomer" then
    CustomerId = trim(request.fo rm("CustomerId" ))
    strupdate="UPDA TE customer SET CustomerId ='"&CustomerId& "',firstname='" &Firstname&"'"& ","
    strupdate=strup date&"Lastname ='"&lastname&"' ,Gender='"&Gend er&"'"&","
    strupdate=strup date&"email ='"&email&"',ph one='"+phone+"' "&","
    strupdate=strup date&"nation ='"&nation&"',c ustomertype ='"&customertyp e&"'"&","
    strupdate=strup date&"note='"&n ote&"',status=' "&statuss&" '"
    strupdate=strup date&"WHERE CustomerId ='"+request.Que ryString("Custo merId")+"';"

    'response.Write (strupdate)
    Set rs = Conn.execute(st rupdate)---(error here)
    Response.Redire ct("ListCustome r.asp")
    rs.Close
    Set rs=nothing
    end if
    thanks
    Regards
    Hoang Phuc
  • shweta123
    Recognized Expert Contributor
    • Nov 2006
    • 692

    #2
    Hi,

    Try writing update query like this :
    Code:
        strupdate="UPDATE customer SET CustomerId ='"&CustomerId&"',firstname="'&Firstname&'" "
    strupdate= strupdate & "Lastname ="'&lastname&'",Gender="'&Gender&'" "
    strupdate=strupdate & "email ="'&email&'",phone="' & phone &'" "
    strupdate=strupdate &"nation ="'&nation&'",customertype ="'&customertype&'" "
    strupdate=strupdate&"note="'&note&'",status="'&statuss&'" "
    strupdate=strupdate& " WHERE CustomerId = "'& request.QueryString("CustomerId")&'"; "
    
    Set rs = Conn.execute(strupdate)
    Originally posted by phuc2583
    I don't think my code get to error;
    please check the code for me
    i have found but i can see where error was
    this is my code UPDATE:
    if trim(request("O ption"))="EditC ustomer" then
    CustomerId = trim(request.fo rm("CustomerId" ))
    strupdate="UPDA TE customer SET CustomerId ='"&CustomerId& "',firstname='" &Firstname&"'"& ","
    strupdate=strup date&"Lastname ='"&lastname&"' ,Gender='"&Gend er&"'"&","
    strupdate=strup date&"email ='"&email&"',ph one='"+phone+"' "&","
    strupdate=strup date&"nation ='"&nation&"',c ustomertype ='"&customertyp e&"'"&","
    strupdate=strup date&"note='"&n ote&"',status=' "&statuss&" '"
    strupdate=strup date&"WHERE CustomerId ='"+request.Que ryString("Custo merId")+"';"

    'response.Write (strupdate)
    Set rs = Conn.execute(st rupdate)---(error here)
    Response.Redire ct("ListCustome r.asp")
    rs.Close
    Set rs=nothing
    end if
    thanks
    Regards
    Hoang Phuc

    Comment

    Working...