Results 1 to 3 of 3
  1. #1
    StalaK is offline Member
    Join Date
    May 2011
    Posts
    1
    Rep Power
    0

    Default Can't seem to get a count(*) where query working

    I'm kind of new to this and I'm trying to check the existence of a record in my database using count(*).

    In MySQL the query is simply SELECT COUNT(*) FROM user WHERE username = 'name'; where 'name' is a variable set by the user's input, I just can't seem to find out how to get the result of the query stored in an integer variable. If anyone could help that would be great.

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    8

    Default

    uhm int whatever = resultset.getInt(1), maybe?

    See the JDBC tutorials.

  3. #3
    Join Date
    Mar 2010
    Posts
    12
    Rep Power
    0

Similar Threads

  1. Count down
    By tj_wolf2 in forum New To Java
    Replies: 8
    Last Post: 03-14-2011, 05:07 PM
  2. Replies: 2
    Last Post: 01-04-2011, 04:30 AM
  3. to get count value as a variable
    By arunkumarinfo in forum JDBC
    Replies: 2
    Last Post: 03-30-2009, 01:32 AM
  4. Replies: 8
    Last Post: 05-28-2008, 07:00 AM
  5. Getting row count
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-11-2008, 08:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •