Here is the code:
  ps = con.prepareStatement("select first, last from cust where ssn=?");
        int ssnint = Integer.parseInt(ssn.trim());
        ps.setInt(1, ssnint);
        ResultSet rs=ps.executeQuery();
        if ( rs.next()) {
                rs.close();
                out.println("Customer already exists " + Integer.parseInt(ssn));
                return;
        }
   
  do  insert (not shown)
   
  I get the message "customer already exists" for EVERY ssn that I tried.
   
   
   
  

Hassan Schroeder <[EMAIL PROTECTED]> wrote:
  On 12/30/06, murthy gandikota wrote:
> I am getting the same result in Java code, i.e. the resultset returned is
> non-null even though the primary key value is not found in the table.

Without seeing code, it's hard to say -- but I'll just guess that you're
assuming an *empty* ResultSet is a null object, and that's simply not
true.

HTH,
-- 
Hassan Schroeder ------------------------ [EMAIL PROTECTED]


 __________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to