Go4Expert

Go4Expert (http://www.go4expert.com/)
-   JSP (http://www.go4expert.com/forums/jsp/)
-   -   problem in update (http://www.go4expert.com/forums/problem-in-update-t2576/)

qurratulain 16Jan2007 20:46

problem in update
 
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+"'");
        %>


pradeep 18Jan2007 10:53

Re: problem in update
 
You cannot use the WHERE clause in an INSERT statement, and you needn't put a bracket '(' after SET in the a UPDATE statment.


All times are GMT +5.5. The time now is 23:54.