Hi
  I have created a table with the following specs:
  create table `cust` (
        `ssn` int(9) NOT NULL PRIMARY KEY,
        `submitdate` date,
        `submitto`  int(3),
        `first` varchar(30),
        `last`  varchar(30),
        `loanAmt` decimal(10,2),
        `company`       int(3),
        `fee`   int(3),
        `appType`  int(3),
        `appSource` int(3),
        `appStatus` int(3),
        `dateStatus` date,
        `fundedAmt`  decimal(10,2)
)
   
  When I try to do select (first, last) where ssn=notthere I get a Result Set 
that is non null even though the ssn is not in the table. My logic is as 
follows:
  a) if ssn is found return<sql:connection id="conn1">
  
<sql:url>jdbc:mysql://trig2:3306/appsubmit?user=bstein&password=siket281</sql:url>
  <sql:driver>com.mysql.jdbc.Driver</sql:driver>
</sql:connection>
  
<!-- <jsp:getProperty name="conn1" property="closed"/> -->
  <sql:preparedStatement id="stmt" conn="conn1">
  <sql:query>
        select first, last from cust where ssn=?
  </sql:query>
    <sql:setColumn position="1"><%= ssn %></sql:setColumn>
  <sql:resultSet id="rset">
      <sql:getColumn colName="first" to="fname" />
      <sql:getColumn colName="last"  to ="lname"/>
  </sql:resultSet>
  <sql:wasEmpty>
                <sql:preparedStatement id="stmt2" conn="conn1">
                Applicant successfully added
                <sql:query>
                insert into cust (ssn, submitdate, submitto, first, last, 
loanAmt, company, fee, appType, appSource) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
                </sql:query>
                <sql:execute>
                <sql:setColumn position="1"> <%= Integer.parseInt(ssn) %> 
</sql:setColumn>
                <sql:setColumn position="2"> <%= yyyy + "-" + mm + "-" + dd %> 
</sql:setColumn>
                <sql:setColumn position="3"> <%= Integer.parseInt(finance) %> 
</sql:setColumn>
                <sql:setColumn position="4"> <%= first %>  </sql:setColumn>
                <sql:setColumn position="5"> <%= last %> 
</sql:setCo<sql:setColumn position="9"> <%= Integer.parseInt(apptype)  
%></sql:setColumn>
                <sql:setColumn position="10"> <%= Integer.parseInt(appsource)  
%></sql:setColumn>
                </sql:execute>
                </sql:preparedStatement>
  </sql:wasEmpty>
  <sql:wasNotEmpty> Applicant  already present</sql:wasNotEmpty>
</sql:preparedStatement>
  <sql:closeConnection conn="conn1"/>
lumn>
                <sql:setColumn position="6"> <%= Float.parseFloat(loanAmt) 
%></sql:setColumn>
                <sql:setColumn position="7"> <%= Integer.parseInt(company) 
%></sql:setColumn>
                <sql:setColumn position="8"> <%= Integer.parseInt(fee)  
%></sql:setColumn>
   
  b) if ssn is not found then insert
   
  I am posting the relevant JSTL code. I'd appreciate your kind comments. 
Thanks.
   
   
   
   

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

Reply via email to