JDBC ResultSet.getString Before/After Start/End of ResultSet Exception

Posted by Geowil on Stack Overflow See other posts from Stack Overflow or by Geowil
Published on 2012-11-11T04:56:07Z Indexed on 2012/11/11 5:00 UTC
Read the original article Hit count: 220

Filed under:
|
|
|

I have done a lot of searching about this topic through Google but I have yet to find someone using getString() in the way that I am using it so I have not been able to fix this issue in the normal ways that are suggested.

What I am trying to do is to obtain all of the information from the database and then use it to populate a table model within the program. I do so by obtaining the data with getString and place it into a String[] object:

try
    {
        while (rSet.next())
        {
            String row[] = {rSet.getString("DonorName"),rSet.getString("DonorCharity"),((String)rSet.getString("DonationAmount"))};

            model.addRow(row);      
        }
    }

However I am always getting a dialog error message stating those error messages in the title:

Exception: Before start of result set Exception: After end of result set

The data is still added and everything works correctly but it is just annoying to have to dismiss those message windows. Does anyone have some suggestions?

© Stack Overflow or respective owner

Related posts about java

Related posts about mysql