I'm fetching two double values from JDBC, if they are null I want to use these values as null in my textfield and if they are 0 I wanted to populate use them as 0. I've tried resultSet.wasNull but even if I'm getting 0 it is setting them as null value.
This is what I've written.
resultsetPricing = stmtPricingData.executeQuery();
while(resultsetPricing.next()){
if(pricetype.equals("Price List A")){
priceExclVat = resultsetPricing.getDouble("PRICE_EXC_VAT");
priceInclVat = resultsetPricing.getDouble("PRICE_INC_VAT");
if(priceExclVat == 0){
System.out.println("Inside if EXCL");
if(resultsetPricing.wasNull()){
System.out.println("Inside RESULT SET NULL EXCL");
//do something
}
}else if(priceExclVat != 0 || priceExclVat == 0){
System.out.println("Inside ELSE EXCL");
priceExclVatStr = String.valueOf(priceExclVat).replace(".",",");
//do something
}
if(priceInclVat==0){
System.out.println("Inside if INCL");
if(resultsetPricing.wasNull()){
System.out.println("Inside RESULT SET NULL INCL");
//do something
}
}else if(priceInclVat!=0 || priceInclVat==0){
System.out.println("Inside ELSE INCL");
priceInclVatStr = String.valueOf(priceInclVat).replace(".",",");
//do something
}
}
}
Please point out where I'm wrong. TIA