Hi to all... in the following code... i hav problem in the update.. it is updating upto qty and it is not updating value.. it shows error like syntax error in the update statement.... help me to solve this problem
Regards
Pradeep
Regards
Pradeep
Code:
try
{
String query = "insert into Gis values('"+s1+"','"+s2+"','"+s3+"','"+s4+"','"+s5+"','"+s6+"','"+s7+"','"+s8+"','"+s10+"')";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:prism");
stmt=con.createStatement();
stmt1=con.createStatement();
stmt1.executeUpdate(query);
rs=stmt.executeQuery("select * from Stores");
while(rs.next())
{
if((rs.getString("ITEMNAME").equals(s5))||(rs.getString("DEPT").equals(s2)))
{
int n=(rs.getInt(5));
int n1=n-s6;
int n2=(rs.getInt(6));
int n3=n2-s10;
String str="UPDATE Stores SET QTY='"+n1+"',VALUE='"+n3+"' WHERE DEPT='"+s2+"'AND ITEMNAME='"+s5+"'";
stmt2=con.createStatement();
stmt2.executeUpdate(str);
JOptionPane.showMessageDialog(this,new String("GOODS ISSUED"));
}
}
}
catch(ClassNotFoundException e)
{
System.out.println(e);
}
catch(SQLException e)
{
System.out.println(e);
}
}
Comment