Click to See Complete Forum and Search --> : simple ResultSet question
ssukumar
May 11th, 2001, 04:24 PM
Hi,
I am getting a SQLException when I call getString() twice on the same row in my ResultSet. I know there is data there, and it does work the first time, but then I call it the second time on the same row (i.e. I don't even call next() to advance) and I get a SQLException. Any ideas as to why this is happening?
Thanks.
dlorde
May 13th, 2001, 01:16 PM
The JavaDoc for ResultSet says For maximum portability, ResultSet columns within each row should be read in left-to-right order and each column should be read only once. . You didn't say, but if you're trying to read the same column from the same row twice, the implementation may be objecting to the second read (hence the warning in the docs).
Alternatively, it may be that your method arguments are incorrect the second time. Without seeing the code and the exception message, and database table definition, I couldn't say.
Dave
To email me remove '_spamjam' from my email address
ssukumar
May 13th, 2001, 01:22 PM
Ahh, that would be it. Thanks for the pointing that out to me. From all of the testing I have done, I can tell you SQL Server 7 *does* delete it so that you can't read it the second time. It doesn't make much sense to me, but that's the way it is.
codeguru.com
Copyright WebMediaBrands Inc., All Rights Reserved.