The Artima Developer Community
Sponsored Link

Java Answers Forum
ResultSet going out of scope

2 replies on 1 page. Most recent reply: Sep 16, 2003 7:16 AM by David

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Mike Hirst

Posts: 2
Nickname: marshmello
Registered: Sep, 2003

ResultSet going out of scope Posted: Sep 15, 2003 10:31 AM
Reply to this message Reply
Advertisement
I am trying to enable a user to scroll through the records from a database one at a time by using a previous/next combination of buttons. I create a new database statement then postion to the first record from the database and then present the user with a screen that contains the first record. I have put a "Next" button on the screen but when I try to add code to get the next record the ResultSet variable is out of scope and I can not reference it. I belieive this is happening because the resultset is declared in one method and I am trying to use it in another method. The first method is declared "public static void getrecord()" and the ResultSet DocumentResultSet is declared in this method. Can someone tell me how either to make DocumentResultSet visible to other methods or point me to a place that shows example code that enables you to scroll through a record set. I have tried sun's site and it is not very helpfull


Leela

Posts: 16
Nickname: leee
Registered: Sep, 2003

Re: ResultSet going out of scope Posted: Sep 16, 2003 6:30 AM
Reply to this message Reply
I wud like to know if this page is a JSP.
if yes, then on the click of the next button, u will be calling the same JSP again.
Probably, u can set the ResultSet object once when u retrieve it from the DB and then pass this object as a querystring in the <form action > of the JSP. This can be retrieved and move the ResultSet object to point to next row, and then display the data in the required text fields in ur JSP.

David

Posts: 150
Nickname: archangel
Registered: Jul, 2003

Re: ResultSet going out of scope Posted: Sep 16, 2003 7:16 AM
Reply to this message Reply
What's wrong with storing it as an instance variable?

Flat View: This topic has 2 replies on 1 page
Topic: ToolTips in java Previous Topic   Next Topic Topic: How a socket client can recover from Server Crash?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use