๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.api
3 messages
3 total messages Started by andy Wed, 09 Oct 2002 09:12
why my Resultset does not return result ?
#856
Author: andy
Date: Wed, 09 Oct 2002 09:12
30 lines
1717 bytes
hai,

i have  a code like this:
String SQLQuery = "Select memberID from Member where "+
            "Member_Name='"+Login.toLowerCase()+"' and Member_pass ='
"+Password.toLowerCase()+"'";
         ResultSet rs = stmt.executeQuery(SQLQuery);

         String MemberID = null;

         while (rs.next()){
            MemberID = rs.getString("MemberID");
         }

         if (MemberID != null) {
           out.print('Welcome');
         }
         else {
           out.print('Wrong password');
         }

when i trace in this line of code never process:
       while (rs.next()){
            MemberID = rs.getString("MemberID");
         }

ps : i have 5 record  in that table. when i erase where clause that tarouble
statement process.
      JB6
      Oracle 9i
Re: why my Resultset does not return result ?
#858
Author: Tor Iver Wilhelmsen (TeamB)
Date: Wed, 09 Oct 2002 12:25
6 lines
1204 bytes
"andy" <andy@cpssoft.com> writes:

>             "Member_Name='"+Login.toLowerCase()+"' and Member_pass ='
> "+Password.toLowerCase()+"'";

Are you certain the val๏ฟฝues are stored in lower case in the database?
Re: why my Resultset does not return result ?
#867
Author: Tor Iver Wilhelmsen (TeamB)
Date: Thu, 10 Oct 2002 06:36
17 lines
1715 bytes
"andy" <andy@cpssoft.com> writes:

> my guess is if i want to get one row of my database ResultSet can
> not give the result but if i want to get, let say two or more row
> the ResultSet can.  And i do not know is this happen on Oracle
> Database or another Database.

If a JDBC query could not return one row in a ResultSet it wouldn't be
of much use... there is nothing that should prevent it from working if
the result is a single row.

> i suspicion in method ResultSet ".next()".

No, you need to call this at least once.

Have you checked the contents that the combination you send in
actually exists? That's the only possibility I see...
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads