Guest User

Untitled

a guest
Jan 5th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 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. }
  14.  
  15. try{
  16. Class.forName("com.mysql.jdbc.Driver");
  17. conn=DriverManager.getConnection("jdbc:mysql://localhost/bellissimo","root"," ");
  18. int k =JOptionPane.showConfirmDialog(null,"Do you wish to add a new record?");
  19. if(k==JOptionPane.YES_OPTION){
  20. st=conn.createStatement();
  21. String query="Update details set customerid="+idTF.getText()+"customername="+nameTF.getText()+"phoneno="+phnTF.getText()+"address="+adrsTF.getText()+"'where customerid="+idTF.getText()+";";
  22. st.executeUpdate(query);
  23. JOptionPane.showMessageDialog(null,"Record Updated");
  24. }
  25. catch(Exception x){
  26. JOptionPane.showMessageDialog(null,x.getMessage());}
  27. }
Add Comment
Please, Sign In to add comment