Guest User

Untitled

a guest
Feb 18th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. try {
  2. Connection c=DriverManager.getConnection("jdbc:mysql://localhost:3306/java","root","");
  3. String Show1="select * from notices where status='0'";
  4. PreparedStatement pst=c.prepareStatement(Show1);
  5. ResultSet rs=pst.executeQuery();
  6. while(rs.next()){
  7. String n=rs.getString("name");
  8. String d=rs.getString("message");
  9. JLabel nam=new JLabel();
  10. nam.setText(""+n);
  11. jPanel13.add(nam);
  12. JLabel de=new JLabel();
  13. jPanel13.add(de);
  14. de.setText(d);
  15. }
  16. String status="update notices set status='1' where status='0'";
  17. PreparedStatement pts=c.prepareStatement(status);
  18. pts.executeUpdate();
  19.  
  20. } catch (Exception e) {
  21. System.out.println(e);
  22. }
Add Comment
Please, Sign In to add comment