I am working in Java and I need to place a jLabel that obtains information from the Database, in this case it is a "Registration Number" every time that the Form will be done, you must bring the name and upload it in said Jlabel. I have tried several ways and I still can not do it.
private void numeros() throws SQLException{
String SQL= ("select max(nregistro) from muestras");
Statement pst = cn.prepareStatement(SQL);
ResultSet ResultSet =pst.executeQuery();
try {
while(ResultSet.next()){
String c =ResultSet.getString(1);
System.out.println(c);
this.txt_registro.setText(String.valueOf(c));
}
} catch (SQLException ex) {
Logger.getLogger(LoqNuevo.class.getName()).log(Level.SEVERE, null, ex);
}
}