Advertisement
Guest User

Untitled

a guest
May 8th, 2019
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.81 KB | None | 0 0
  1. public void sprIdNadawcy(){
  2. try{
  3. queryString = "select ID, Imie, Nazwisko from Osoby";
  4. ResultSet rs = db.statement.executeQuery(queryString);
  5. while (rs.next())
  6. {
  7. imie = (String) rs.getObject("Imie");
  8. nazwisko = (String) rs.getObject("Nazwisko");
  9.  
  10. if ((imie + " " + nazwisko).equals(nadawca))
  11. {
  12. idNadawcy = (int) rs.getObject("ID");
  13. System.out.println(idNadawcy);
  14. }
  15. }
  16. } catch (Exception e)
  17. {
  18. e.printStackTrace();
  19. }
  20. }
  21.  
  22. ====================================================================================================================
  23. public void sprNrWiadomosci(){
  24. try{
  25. queryString = "select ID, id_wysylajacego from Wiadomosc ";
  26. ResultSet rs = db.statement.executeQuery(queryString);
  27. for (int i = 0; rs.next(); i++)
  28. { idWiadomosci = rs.getInt("ID");
  29. tempIdNadawcy = rs.getInt("id_wysylajacego");
  30. // System.out.println(idWiadomosci + " " + tempIdNadawcy);
  31. if (tempIdNadawcy == idNadawcy)
  32. idWiadomosci = this.idWiadomosci;
  33. }
  34. }catch (Exception e)
  35. {
  36. e.printStackTrace();
  37. }
  38.  
  39. }
  40.  
  41. =============================================================================================
  42.  
  43.  
  44.  
  45.  
  46. for(int i=0; i<tabelaWiadomosci.getRowCount();i++)
  47. {
  48. System.out.println("========OPCJA ZAPISU KOLEJNY WIERSZ========");
  49. {
  50. if(tabelaWiadomosci.getValueAt(i, 2) == null)
  51. tabelaWiadomosci.setValueAt(false, i, 2);
  52.  
  53. if(tabelaWiadomosci.getValueAt(i, 2).equals(true))
  54. {
  55. System.out.println(tabelaWiadomosci.getValueAt(i, 0));
  56. nadawca = (String) tabelaWiadomosci.getValueAt(i, 0);
  57. // sprIdNadawcy();
  58. // ustawieniePrzeczytania();
  59. // sprNrWiadomosci();
  60. }
  61. else
  62. if(tabelaWiadomosci.getValueAt(i, 2).equals(false))
  63. System.out.println("wiersz nr "+i+" jest NIEZAZNACZONY");
  64. }
  65. System.out.println("==========================================");
  66. {
  67. if (tabelaWiadomosci.getValueAt(i, 3).toString().isEmpty())
  68. {
  69. System.out.println("pole tekst jest puste");
  70. }
  71. else
  72. {
  73. nadawca = (String) tabelaWiadomosci.getValueAt(i, 0);
  74. sprIdNadawcy();
  75. sprNrWiadomosci();
  76. // System.out.println("==============sprawdzam id nadawcy==================");
  77. // System.out.println(idNadawcy);
  78. System.out.println(idWiadomosci);
  79. // System.out.println("=================");
  80. tekst = (String) tabelaWiadomosci.getValueAt(i, 3);
  81. System.out.println(tekst);
  82. System.out.println(nadawca);
  83. }
  84. }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement