Guest User

Untitled

a guest
Nov 16th, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. String nos =(String) t1.getText();
  2. String pn = (String)t2.getText();
  3. String ano = (String)t3.getText();
  4. String co =(String) t4.getText();
  5. String cmb= (String)cmb1.getSelectedItem();
  6. String dob=(String) t5.getText();
  7. if (opt1.isSelected()==true){
  8. String pm= "MBA";
  9. try
  10. {
  11. Class.forName("java.sql.Driver");
  12. Connection con=DriverManager.getConnection("jdbc:mysql://localhost/hameed","root","iis");
  13. Statement st=con.createStatement();
  14. st.executeUpdate("insert into univad values ('"+nos+"','"+pn+"','"+ano+"','"+co+"','"+cmb+"','"+dob+"','"+pm+"');");
  15. st.close();
  16. con.close();
  17. }
  18. catch(Exception e)
  19. {
  20. System.out.println("error inconnectivity");
  21. }
  22. }
  23.  
  24. else if (opt2.isSelected()==true){
  25. String pm="BBA";
  26. try
  27. {
  28. Class.forName("java.sql.Driver");
  29. Connection con=DriverManager.getConnection("jdbc:mysql://localhost/hameed","root","iis");
  30. Statement st=con.createStatement();
  31. st.executeUpdate("insert into univad values ('"+nos+"','"+pn+"','"+ano+"','"+co+"','"+cmb+"','"+dob+"','"+pm+"');");
  32. st.close();
  33. con.close();
  34. }
  35. catch(Exception e)
  36. {
  37. System.out.println("error inconnectivity");
  38. }
  39. try
  40. {
  41. Class.forName("java.sql.Driver");
  42. Connection con=DriverManager.getConnection("jdbc:mysql://localhost/hameed","root","iis");
  43. Statement st=con.createStatement();
  44. st.executeUpdate("insert into univad values ('"+nos+"','"+pn+"','"+ano+"','"+co+"','"+cmb+"','"+dob+"','"+pm+"');");
  45. st.close();
  46. con.close();
  47. }
  48. catch(Exception e)
  49. {
  50. System.out.println("error inconnectivity");
  51. }
  52. }
  53.  
  54. else if (opt3.isSelected()==true){
  55. String pm="ELECTRICAL ENGINEERING";
  56. try
  57. {
  58. Class.forName("java.sql.Driver");
  59. Connection con=DriverManager.getConnection("jdbc:mysql://localhost/hameed","root","iis");
  60. Statement st=con.createStatement();
  61. st.executeUpdate("insert into univad values ('"+nos+"','"+pn+"','"+ano+"','"+co+"','"+cmb+"','"+dob+"','"+pm+"');");
  62. st.close();
  63. con.close();
  64. }
  65. catch(Exception e)
  66. {
  67. System.out.println("error inconnectivity");
  68. }
  69. }
  70.  
  71.  
  72. }
Add Comment
Please, Sign In to add comment