Guest User

Untitled

a guest
Nov 19th, 2017
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. public void RandomAcc(){
  2. Random ra=new Random();
  3. jTextField1.setText(""+ra.nextInt(10000+1));
  4. }
  5. public void RandomMICR(){
  6. Random ra=new Random();
  7. jTextField2.setText(""+ra.nextInt(1000+1));
  8. }
  9. public void RandomPIN(){
  10. Random ra=new Random();
  11. jTextField3.setText(""+ra.nextInt(1000+1));
  12. }
  13. public void Bal(){
  14. String sql="insert into Balances(Name,Acc,MICR_No,Balance) values(?,?,?,?)";
  15. try{
  16. pst=conn.prepareStatement(sql);
  17. pst.setString(1, jTextField5.getText());
  18. pst.setString(2, jTextField1.getText());
  19. pst.setString(3, jTextField2.getText());
  20. pst.setString(4, jTextField10.getText());
  21. pst.execute();
  22. }catch(Exception e){`enter code here`
  23. JOptionPane.showMessageDialog(null, e);
  24. }
  25.  
  26. String sql="insert into Account(Acc,Name,DOB,Pin,Acc_Type,Nationality,Caste,MICR_No,Gender,Mob,Address,Sec.Q,Sec.A,Balance) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  27. try{
  28. pst=conn.prepareStatement(sql);
  29. pst.setString(1, jTextField1.getText());
  30. pst.setString(2, jTextField5.getText());
  31. pst.setString(3,((JTextField)jDateChooser1.getDateEditor().getUiComponent()).getText());
  32. pst.setString(4, jTextField3.getText());
  33. pst.setString(5, (String) jComboBox1.getSelectedItem());
  34. pst.setString(6, (String) jComboBox2.getSelectedItem());
  35. pst.setString(7, jTextField6.getText());
  36. pst.setString(8, jTextField2.getText());
  37.  
  38. jRadioButton1.setActionCommand("Male");
  39. jRadioButton2.setActionCommand("Female");
  40. pst.setString(9, buttonGroup1.getSelection().getActionCommand());
  41.  
  42. pst.setString(10, jTextField7.getText());
  43. pst.setString(11, jTextField4.getText());
  44. pst.setString(12, (String) jComboBox3.getSelectedItem());
  45. pst.setString(13, jTextField9.getText());
  46. pst.setString(14, jTextField10.getText());
  47. pst.execute();
  48. JOptionPane.showMessageDialog(null, "Congrtzn Account has been Created");
  49. Bal();
  50. }catch(Exception e){
  51. JOptionPane.showMessageDialog(null, e);
  52. }
  53. }
Add Comment
Please, Sign In to add comment