| Author |
Storing The ResultSet
|
Raymond O'Leary
Greenhorn
Joined: Mar 23, 2004
Posts: 24
|
|
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.
|
 |
eammon bannon
Ranch Hand
Joined: Mar 16, 2004
Posts: 140
|
|
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.
|
 |
Raymond O'Leary
Greenhorn
Joined: Mar 23, 2004
Posts: 24
|
|
|
Yeah it returns a value, my problem is putting that value into the string ans and using that value in a further sql statement.
|
 |
eammon bannon
Ranch Hand
Joined: Mar 16, 2004
Posts: 140
|
|
And your second query? Have you tried running it against the DB? You still seem to be trying to use a closed ResultSet too...
|
 |
Raymond O'Leary
Greenhorn
Joined: Mar 23, 2004
Posts: 24
|
|
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.
|
 |
Raymond O'Leary
Greenhorn
Joined: Mar 23, 2004
Posts: 24
|
|
Ah its working now. Thanks for your help buddy.
|
 |
Stefan Wagner
Ranch Hand
Joined: Jun 02, 2003
Posts: 1923
|
|
Why don't you use directly:
|
http://home.arcor.de/hirnstrom/bewerbung
|
 |
Raymond O'Leary
Greenhorn
Joined: Mar 23, 2004
Posts: 24
|
|
All working now thanks for the help guys. Ray
|
 |
 |
|
|
subject: Storing The ResultSet
|
|
|