PDA

Click to See Complete Forum and Search --> : Simple and Urgent: JDBC Question


cantene
May 13th, 2001, 11:27 AM
Dear Friends,
If I use

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

Wynd
May 13th, 2001, 11:32 AM
Well, if rs is a string, you could try

if (rs.length() > 0) //or however long you need it
loginResult = 1;
else
loginResult = 0;

cantene
May 13th, 2001, 11:49 AM
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

sweetsupra
May 17th, 2001, 02:57 PM
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