Hey Guys me again! Here I'm trying to store the sole result into a string called ans, and use the string in another query. as dar as i can tell the ans string isn't getting any values? Can anybody shed some light on this? Thanks guys.
Does your SQL actually return anything? Have you tried logging what value UName has? Also, in amongst your out.println stuff, you seem to be trying to use the closed ResultSet rs - this might be where your problem is.
Yeah second query works perfectly I put this in batween the selects, and the value is printed out.
Its this bit here! Does it look correct? [ CODE] String ans=null; while(rs.next()) { ans = rs.getString(1); } rs.close(); [/CODE] and thanks for pointing out the closed rs1 for me.