Guest User

Untitled

a guest
Jan 4th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. try{
  2. Class.forName("java.sql.Driver");
  3. conn=DriverManager.getConnection("jdbc:mysql://localhost/bellissimo","root"," ");
  4. int k =JOptionPane.showConfirmDialog(null,"Do you wish to add a new record?");
  5. if(k==JOptionPane.YES_OPTION){
  6. st=conn.createStatement();
  7. String query="Update details set customerid="+idTF.getText()+"customername="+nameTF.getText()+"phoneno="+phnTF.getText()+"address="+adrsTF.getText()+"'where customerid="+idTF.getText()+";";
  8. st.executeUpdate(query);
  9. JOptionPane.showMessageDialog(null,"Record Updated");
  10. }
  11. catch(Exception x){
  12. JOptionPane.showMessageDialog(null,x.getMessage());}
  13. }
Add Comment
Please, Sign In to add comment