Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. public void fillCombo()
  2. {
  3. Connection connection = null;
  4. ResultSet rs = null;
  5. Statement statement = null;
  6.  
  7. try {
  8. Class.forName("org.sqlite.JDBC");
  9. connection = DriverManager
  10. .getConnection("jdbc:sqlite:d:\\dbsql\\pizza.db3");
  11. statement = connection.createStatement();
  12. rs = statement.executeQuery("select fahrzeugnr from fahrzeuge");
  13.  
  14. while (rs.next())
  15. {
  16. jComboBoxMnr.addItem(rs.getString("fahrzeugNr"));
  17. }
  18.  
  19.  
  20.  
  21. }
  22. catch (Exception e)
  23. {
  24. e.printStackTrace();
  25. }
  26. finally {
  27. try {
  28. rs.close();
  29. connection.close();
  30. statement.close();
  31. } catch (SQLException e) {
  32. // TODO Auto-generated catch block
  33. e.printStackTrace();
  34. }
  35.  
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement