Hi!
"Invalid cursor state" will arise when you access the
first field in the recordset after accessing the
second field. ie you have to access the fields of
record set in the order in which you call in your
select statement.
Poornima Visvesvaran.
--- Jennifer Feeney <[EMAIL PROTECTED]>
wrote:
> Hi all,
>
> Could anyone tell me why the following code is
> generating an "Invalid
> Cursor State" response.
>
> I have read the Archives and have found similiar
> problems, have made
> the changes suggested in the archives, but it still
> doesn't work.
>
> Thank you to anyone in advance for your help, and
> also to all that
> have helped with my questions to date...Thank You!
>
> Below is the code, any help would be greatly
> appreciated.
>
> Code:
>
======================================================================
> =========
>
> try{
>
> Statement statement =
> connection.createStatement();
> String query = "SELECT Id
> FROM Details " +
>
> "WHERE
> Password = '" + password + "'";
> Statement statement1 =
> connection.createStatement();
> String query1 = "SELECT
> Password FROM
> Details " +
>
> "WHERE Id = "
> + id ;
>
> ResultSet rs =
> statement.executeQuery(
> query );
>
> rs.next();
> int idT = rs.getInt("Id");
>
> ResultSet rs1 =
> statement1.executeQuery(
> query1 );
> rs1.next();
> String passwordT =
> rs1.getString("Password");
>
>
> int x =
> passwordT.compareTo(password);
> int y =
> Integer.parseInt(id);
>
>
> if(x == 0 && idT ==
> y){
>
> output.println(
> "<H1><Font
> color:Red>Welcome to our Online
> Service!</FONT><BR></H1>");
>
> output.println(getServletInfo());
>
> }
>
> if(x > 0 ){
> output.println(
> "<H1><Font
> color:Red>Incorrect Password!</FONT><BR></H1>");
> output.println(
> "<BR><BR><H1><Font
> color:Blue>Please click the, Back, button and try
> again!
> </FONT><BR></H1>");
> }
>
> if(idT != y){
> output.println(
> "<H1><Font
> color:Red>Incorrect Id Entered!</FONT><BR></H1>");
> output.println(
> "<BR><BR><H1><Font
> color:Blue>Please click the, Back, button and try
> again!
> </FONT><BR></H1>");
> }
>
>
> statement.close();
> statement1.close();
> }
>
======================================================================
> ==================
> Code End.
>
>
> Thanks again, for your help.
>
> Best Regards,
> Jennifer
>
>
> _____________________________________
>
> Get your free E-mail at http://www.ireland.com
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED]
> and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives:
>
http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
>
http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help:
http://www.lsoft.com/manuals/user/user.html
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html