:-)
yes and no
I must move the pointer to the next result IF i'll have several result.
If he want juste one name and one password, he don't need to make a while
(resutl.next())
but if i must make a traitment with several result, then i am agree with you
;)
2 possibilities :
1.
select name,password from table where name like "variable"
->
if result == null
// no user found
else
// user found
2.
Select name,password from table
while (result.next())
{
String user = result.getString(1);
if (user.equals("variable") == true)
{
// user found
String password = result.getString(2);
....
}
}
byeeeeeeee
-----Original Message-----
From: Shivkumar B Nayak [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 26, 2000 12:01 PM
To: [EMAIL PROTECTED]
Subject: Re: ODBC problem
Hi,
Agree with first statement , i was really blind.
But your second statement is wrong. you have advance the pointer.
Hope this will help you
Shiva
----- Original Message -----
From: BERWART Thierry <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 26, 2000 15:25
Subject: Re: ODBC problem
> Hello !!!!
> Are you blind ??
> How do you want to get the password if you don't ask it to the database
????
> --- rsStudente= stat.executeQuery("SELECT Nome FROM Utenti");
>
> -> rsStudente= stat.executeQuery("SELECT Nome,Password FROM Utenti");
> ----------
>
> and if you want just one result,
> you don't use the rsStudente.next() !
>
>
> -----Original Message-----
> From: Shivkumar B Nayak [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 26, 2000 11:32 AM
> To: [EMAIL PROTECTED]
> Subject: Re: ODBC problem
>
>
> Hi palanca,
>
> You have to change your code this way
>
> while(rsStudente.next())
> {
> String nome = rsStudente.getString("Nome");
> String passw = rsUser.getString("Password");
> }
> problem is u should call next() method of resultset to advance pointer to
> the
> first row.If you have any problem feel free to ask me.
>
> Shiva
> ----- Original Message -----
> From: Elena Palanca <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, September 26, 2000 14:37
> Subject: ODBC problem
>
>
> > Hy,
> > I'm tried to connect in a servlet to an ACCESS database doing a select
> > operation and I have the following error:
> >
> > [parseRequest]Errore 2:java.sql.SQLException: [Microsoft][ODBC Driver
> > Manager] Stato del cursore non valido. (Invalid Cursor State)
> >
> > In the Access Table I have only a row with the field Nome and Password
> >
> > My code is the following:
> >
> > String userId = req.getParameter( "UserId" );
> > try{
> > Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
> > Connection con = DriverManager.getConnection
> > ("jdbc:odbc:Esami","","");
> > Statement stat= con.createStatement();
> > rsStudente= stat.executeQuery("SELECT Nome FROM Utenti");
> > String nome = rsStudente.getString("Nome");
> > String passw = rsUser.getString("Password");
> > if ((nome.equals(userId))) auth="true";
> > rsStudente.close();
> > stat.close();
> > }catch (Exception e) {
> > log( "[parseRequest]Errore 2:" + e.toString() );
> > }
> >
> > Someone know what I'm doing wrong?
> >
> > Thanks in advance
> >
> > Elena
> >
> >
>
___________________________________________________________________________
> > 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
> >
>
>
___________________________________________________________________________
> 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
>
>
___________________________________________________________________________
> 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
___________________________________________________________________________
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
___________________________________________________________________________
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