public void cosUpdate(String sr,String name,String fname,String adress,String phone,String refernce,String tailor)
{
try{
String QUERY1 = "UPDATE Info1 SET FatherName = '"+fname+"' WHERE Sr = '"+sr+"'";
JOptionPane.showMessageDialog(null,QUERY1);
Class.forName(JDBC_DRIVER);
connection=DriverManager.getConnection(DATABASE_URL);
statement=connection.createStatement();
result =statement.executeUpdate(QUERY1);
if(result >0)
JOptionPane.showMessageDialog(null,"Successfull");
else
JOptionPane.showMessageDialog(null,"UnSuccessfull");
}
catch(Exception ex)
{
JOptionPane.showMessageDialog(null,"Error in cosUpdate() Method","Error",JOptionPane.ERROR_MESSAGE);
}
finally{
try{
resultset.close();
statement.close();
connection.close();
}
catch(Exception ex){
}
}
RazaAjmi
0
Newbie Poster
Recommended Answers
Jump to Postalso, the next two parts of your code:
catch(Exception ex) { JOptionPane.showMessageDialog(null,"Error in cosUpdate() Method","Error",JOptionPane.ERROR_MESSAGE); } catch(Exception ex){ }
might cause you some trouble:
- always catch your exceptions as specific possible, don't just rely on the Exception class to do the Pokémon move and "Catch'em all!!"
…
All 3 Replies
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
masijade
1,351
Industrious Poster
Team Colleague
Featured Poster
stultuske
1,116
Posting Maven
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.