problem in update

Discussion in 'JSP' started by qurratulain, Jan 16, 2007.

  1. qurratulain

    qurratulain New Member

    Joined:
    Oct 16, 2006
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    0
    hi
    sir i m having problem in updating the record .

    i m trying the query to update .but it is giving me the "
    Syntax error problem"

    Code:
     //stmt.executeUpdate("UPDATE StdInfo SET(STD_GR='"+gr+"', Name='"+name+"', Fname='"+fname+"', Surname='"+sname+"', Guardian-Name='"+gname+"', Religion='"+rel+"',Age='"+age+"',Date-of-Birth='"+dd+"',Month-of-Birth='"+mon+"',Year-of-Birth='"+year+"',Birth-Place='"+birthplace+"',Birth-District='"+bitrhdistrict+"',Country='"+country+"',Temp-Address='"+add+"',Perm-Address='"+padd+"',Phone='"+phone+"',Password='"+password+"') where STD_GR='"+gr+"'");
    
    2nd

    Code:
    
    	stmt.executeUpdate("insert into StdInfo values('"+gr+"','"+name+"','"+fname+"','"+sname+"','"+gname+"','"+rel+"','"+age+"','"+dd+"','"+mon+"','"+year+"','"+birthplace+"','"+bitrhdistrict+"','"+country+"','"+add+"','"+padd+"','"+phone+"','"+password+"') where STD_GR='"+gr+"'");
    	%>
    
    
    
     
  2. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    You cannot use the WHERE clause in an INSERT statement, and you needn't put a bracket '(' after SET in the a UPDATE statment.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice