hi i'm having problems with my search logic if (rs!=null){ while(rs.next()) { } } else { out.println("no results") } it seem that if no results from databases it woudn't display "no results" can anyone pls help me.. thanx
if(rs!=null) { if(rs.next()) { //display result } else { //Not exist } } Hope this will work fine.. Pranit.
Originally posted by Jardel Tan: hi i'm having problems with my search logic if (rs!=null){ while(rs.next()) { } } else { out.println("no results") } it seem that if no results from databases it woudn't display "no results" can anyone pls help me.. thanx
As you can see, there's more than one way to do it. I like this one:
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
I use this to find out if there's data back from database. This will show you how many rows are in the resultset. int rowcnt=0; rs.last(); rowcnt = rs.getRow();