Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

With out using resultset..?

 
santhosh.R gowda
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all

Is is possible to know where the record exists in DataBase for a preticular condition with out using Result set object
For Ex:- iwant to check the userid in database so that i will check in database and using result set i will forward my logic .
 
Jan Cumps
Bartender
Posts: 2608
14
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ResultSet is the interface to retrieve answers from your database.
Is there a reason why you can't use it for this purpose?
 
Tim Holloway
Saloon Keeper
Posts: 18365
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Santhosh, you might want to get someone to help you to phrase that question a little more understandably.

I think what you're trying to do is the common case where you want to see if a user is defined in a database, but you do not actually want to retrieve any of the user data. The SQL version of that would be:


Or, if you're doing a login check:


These queries do return a result set, but it has only one row and one column, and its value is either 1 (user exists, password valid) or 0 (user does not exist, or password is invalid).

So, while you need a ResultSet, the logic isn't all that complicated and the overhead is pretty low:


This code won't execute - I've done some simplifications to illustrate the concept, but it's basically how you'd do something like that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic