Advertisement
Guest User

Untitled

a guest
Dec 21st, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
  2. if (evt.getSource() == jButton1) {
  3. String radiotext = "";
  4. if (jRadioButton1.isSelected()) {
  5. radiotext = jRadioButton1.getText();
  6. }
  7. if (jRadioButton2.isSelected()) {
  8. radiotext = jRadioButton2.getText();
  9. }
  10. try {
  11. String OracleThin = "oracle.jdbc.driver.OracleDriver";
  12. Class.forName(OracleThin);
  13. Connection con = DriverManager.getConnection("jdbc:oracle:thin:@amrita-pc:1521:XE", "user2", "user2");
  14. PreparedStatement stat = con.prepareStatement("insert into stu_basic values(stu_basic_sequence,?,?,?,'" + radiotext + "',to_date(?,'yyyy-mm-dd'),?,?,?,?,?)");
  15. stat.setString(2, .getInt());
  16. stat.setString(3, fn.getText());
  17. stat.setString(4, mn.getText());
  18. stat.setString(5, radiotext);
  19. stat.setDate(6, dob.getText());
  20. stat.setString(7, a1.getText());
  21. stat.setString(8, city.getText());
  22. stat.setString(9, state.getText());
  23. stat.setInt(10, phone.getInt());
  24. stat.setString(11, email.getText());
  25. stat.executeUpdate();
  26. } catch (Exception e) {
  27. System.out.println("" + e);
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement