Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

If no matching records found, how do I display a message?

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,
I'm a beginner. I want to display a message "No matching records found" and having difficulty.
This is my code that I need to modify to display such message...

I know that I need a code similar to this:

but so far my attempts failed miserably.
I would greatly appreciate any of your help.
Thank you.
Katia.
[ Edited to remove long lines. Please don't post long lines of code in a code block. Thanks -ds ]
[ October 10, 2002: Message edited by: Dirk Schreckmann ]
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try one of the following
rs.last()
or
rs.afterLast()
or
rs.wasNull()
One of those should work
 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would be a lot simpler if you construct the table contents with a StringBuffer first and then write into the PrintWriter object. Also a lot efficient.
That way, you check if the StringBuffer is empty to display your "no data found" message instead.
Moreover, I notice that you are specifying font size for every column in every row. That is not neccessary. You can move the font declaration to the table or above it.
ADDED LATER - after looking thru your code again, I find a StringBuffer was used and is getting displayed. You seem to be on the right track. why did you opt out of this approach?
[ October 11, 2002: Message edited by: Vin Kris ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic