1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

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,646
    Likes Received:
    86
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    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