Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. try {
  2.  
  3. Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
  4. Connection con = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databaseName=db_user_info1;username=sa;password=p@ssw0rd");
  5. String sql = "delete tbl_user_info where number = '" + txt_number.getText() + "'";
  6. PreparedStatement pst = con.prepareStatement(sql);
  7. int rs = pst.executeUpdate();
  8.  
  9. JOptionPane.showMessageDialog(null, "Successfully deleted!");
  10. loaddata();
  11. con.close();
  12. txt_lname.setText("");
  13. txt_fname.setText("");
  14. txt_mname.setText("");
  15. txt_add.setText("");
  16. txt_cell.setText("");
  17. txt_citi.setText("");
  18. txt_pla.setText("");
  19. txt_occ.setText("");
  20. txt_inc.setText("");
  21. txt_gua.setText("");
  22. txt_number.setText("");
  23. cbox_rela.setSelectedItem("Single");
  24. cboxmonth.setSelectedItem("Jan");
  25. cboxdate.setSelectedItem("1");
  26. cboxyear.setSelectedItem("2020");
  27. cbox_sex.setSelectedItem("Male");
  28. cboxage.setSelectedItem("1");
  29.  
  30. } catch(Exception e)
  31. {
  32. JOptionPane.showMessageDialog(null, e);
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement