Welcome Guest ( Log In | Register )

Bump Topic Topic Closed RSS Feed

Outline · [ Standard ] · Linear+

 "Before start of result set", Java exception

views
     
TSmvtan
post Mar 31 2006, 11:21 AM, updated 18y ago

Kop king
*****
Senior Member
795 posts

Joined: Jan 2003
From: Anfield Road


Hi guys, I'm relatively new at Java, need help with this one.

Let's say I have a query "SELECT * FROM TABLE"

Then using a recordset, I retrieve the values.
CODE

try {


while(rst.next())
{
//Example
System.out.println(rst.getString(2));
}



} catch (Exception e) {
System.out.println(e);
}

Let's say I have table values:

ID NAME
-- ------
1 A
2 B
3 C
4 D


The while loop starts to display starting from NAME = 'A'
then while the loop is running, and I delete let's say, where NAME='C'.
After displaying the first 2 records, when the loop reaches the entry where NAME='C', it is unable to find that record in the database and returns the "Before start of result set" exception.
My question is, how do I set it to move on to the next record without any exceptions?

This post has been edited by mvtan: Mar 31 2006, 11:23 AM

Topic ClosedOptions
 

Change to:
| Lo-Fi Version
0.0103sec    0.38    5 queries    GZIP Disabled
Time is now: 29th March 2024 - 06:59 PM