Results 1 to 4 of 4

Thread: Simple and Urgent: JDBC Question

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    hongkong
    Posts
    251

    Simple and Urgent: JDBC Question

    Dear Friends,
    If I use
    Code:
    query = "SELECT * FROM Officer WHERE OfficerID='" + OfficerID + "'";
    rs = stmt.executeQuery(query);
    to check whether the guy exists. IF not found, then I will return loginResult = 0.

    But I am afriad of the undetermined result in rs. What's in rs if the OfficerID is not found? Is it null or "" or so? How should I write the following condition?

    if ( ... )
    loginResult = 0
    else
    loginResult = 1

  2. #2
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    Well, if rs is a string, you could try

    if (rs.length() > 0) //or however long you need it
    loginResult = 1;
    else
    loginResult = 0;
    Alcohol & calculus don't mix.
    Never drink & derive.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    hongkong
    Posts
    251

    How to return an array of values from a method

    Dear Friends,

    How can I return more than one value back to the caller please?

    Suppose I have to return an array of string from a method?

    Thanks

  4. #4
    Lively Member
    Join Date
    Jan 2000
    Posts
    69

    hey cantene

    the resultset should return set number values based on a query. In this case....you are returning 1 value and it is most likely int datatype. I have to double check on that, but I am pretty sure that is the int datatype. So in the case of the login check....if it does equal 1 then the person is logged in.


    manoj

Posting Permissions

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



Click Here to Expand Forum to Full Width