有人可以帮我看段代码吗?郁闷中,在线等~~~
public   int   kouanID(String   kouan) 
             {                           
                         try 
                         { 
                                     int   kouanid; 
                                     PreparedStatement   ps   =   DB.getPs( "select   kouanid   from   kouanbiao   where   kouanmingcheng=    ' "+kouan+ " ' ");                                                                                                                                       
                                     ResultSet   rs   =   ps.executeQuery(); 
                                     rs.next(); 
                                     kouanid   =   rs.getInt(1);                                       
                                     return   kouanid; 
                         }catch(Exception   e) 
                         { 
                                     e.printStackTrace(); 
                         } 
                         return   0;                                                     
             }                                           
             在这里调用了上面这个函数 
                         String   kouan; 
                                                 kouan   =   request.getParameter( "kouan "); 
                                                 int   kouanid; 
                                                 kouanid   =   this.kouanID(kouan);                                                                                                     
 为什么得不到kouanid   它总是返回一个0,kouan能得到,传到上面返回来的却是个0
------解决方案--------------------异常有没有,数据库中有没有对应的记录
------解决方案--------------------把 int kouanid; 移到 try 的上面,将 catch 前的 return 移到 return 0; 的地方,把 return 0; 删掉。
------解决方案--------------------你最后还返回0做什么,你开始定义一个变量int kouanid=0,最后返回那个变量就是了
------解决方案--------------------