Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try {
- Connection c=DriverManager.getConnection("jdbc:mysql://localhost:3306/java","root","");
- String Show1="select * from notices where status='0'";
- PreparedStatement pst=c.prepareStatement(Show1);
- ResultSet rs=pst.executeQuery();
- while(rs.next()){
- String n=rs.getString("name");
- String d=rs.getString("message");
- JLabel nam=new JLabel();
- nam.setText(""+n);
- jPanel13.add(nam);
- JLabel de=new JLabel();
- jPanel13.add(de);
- de.setText(d);
- }
- String status="update notices set status='1' where status='0'";
- PreparedStatement pts=c.prepareStatement(status);
- pts.executeUpdate();
- } catch (Exception e) {
- System.out.println(e);
- }
Add Comment
Please, Sign In to add comment