jeudi 26 octobre 2017

don't work if in my java program

what is my code problem? The code does not work correctly After the program is executed, the buttons are either always active or always disabled, even if the condition is not correct

if (clas.classpaging.query_to_db("SELECT COUNT(*) AS rowcount FROM tbl_tempdatewarehouses where date=" + datePickerrequest.getText())) {
    try {
        ResultSet res_temp = clas.classpaging.getResultSet();
        int m = res_temp.getInt("rowcount");
        int n = 1;
        if (m == n) {
            btnedit.setEnabled(true);
            btndelete.setEnabled(true);
            btnregister.setEnabled(true);
        } else {

            btnedit.setEnabled(false);
            btndelete.setEnabled(false);
            btnregister.setEnabled(false);
        }
    } catch (Exception ex) {
        Logger.getLogger(this.getName()).log(Level.SEVERE, null, ex);
    }
}

Aucun commentaire:

Enregistrer un commentaire