public void Cargarnum(){
PreparedStatement pst = null;
ResultSet rs = null;
ResultSet rst = null;
String num = "1";
String ncomp = "";
int entero;
int total;
String total2 = "";
try{
String sql = "SELECT count(*) FROM ventas_clientes";
pst =connect().prepareStatement(sql);
rst = pst.executeQuery();
}catch(Exception e){
System.err.println("Error" + e);
}
if(rst == null){
lblncomp.setText(num);
}else{
try{
String sql = "SELECT ncomp FROM ventas_clientes";
pst =connect().prepareStatement(sql);
rs = pst.executeQuery();
while(rs.next()){
ncomp = rs.getString("ncomp");
entero = Integer.parseInt(ncomp);
total = entero +1;
total2 = Integer.toString(total);
}
lblncomp.setText(total2);
}catch(Exception e){
System.err.println("Error" + e);
}
}
}