• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SQL commands in MS-Access....Pls Help

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the following sql statement in my program:

This statement works as it will pick out the account numbers from the database. BUT when I input an account number that does not exist in the database it does not give me a SQLException, it just sits there !
Anyone have any ideas as to how I can tell the program that if it does not find the account number it should display a message ??
Any help appreciated,
Thanks
Sarwar
[ March 15, 2003: Message edited by: suhail sarwar ]
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sarwar,
With all of the databases that I have worked with, when you execute a database query that does not return any rows, it is not an error (and therefore does not give an "SQLException").
The "next()" method (in "java.sql.ResultSet") returns 'false' if there are no more rows in the result set. For an empty result set (i.e. a query that returns no rows), the first invocation of "next()" will return 'false', example:

Hope this helps you.
Good Luck,
Avi.
 
suhail sarwar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes you are right.I've got it working now thanks for your help.
 
My first bit of advice is that if you are going to be a mime, you shouldn't talk. Even the tiny ad is nodding:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic