G
Gen
Could anyone tell me if there is any mistake in the following
function?
wasNull returns true even for non-null values so the function is
always returning null.
I have spent half a day but am unable to figure out why.
private Float getFloat(ResultSet rs, String col) throws SQLException
{
Float retVal = new Float(rs.getFloat(col));
System.out.println("Val1=" + retVal);
if (rs.wasNull()) retVal=null;
System.out.println("Val2=" + retVal);
return retVal;
}
----- Sample Output ------
Val1=20.0
Val2=null
(Should be Val2=20.0)
------------------
I would appreciate any comments.
Thanks
Gen
function?
wasNull returns true even for non-null values so the function is
always returning null.
I have spent half a day but am unable to figure out why.
private Float getFloat(ResultSet rs, String col) throws SQLException
{
Float retVal = new Float(rs.getFloat(col));
System.out.println("Val1=" + retVal);
if (rs.wasNull()) retVal=null;
System.out.println("Val2=" + retVal);
return retVal;
}
----- Sample Output ------
Val1=20.0
Val2=null
(Should be Val2=20.0)
------------------
I would appreciate any comments.
Thanks
Gen