0
 public static String DuStatusinactiveanddeactive(EmpBean empBeanObj,
                                                ClaimDetailsBean claimDetailsBean,
                                                 HttpServletRequest request) throws SQLException {
        // To get Employee Details from cdm master




        String query = "update GEMS_DELIVERY_UNIT  set isActive=? , TRANS_USER=? where DU_ID=?";
        Connection conn = null;
        conn = DAO.getMsSqlConnection();
        PreparedStatement stmt = null;
        //System.out.println("came into upgradeClaim"+beanObj.getAppr1Id()+"-->"+beanObj.getAppr2Id()+"-->"+beanObj.getAwaitingAppr()+"-->"+beanObj.getClaimStatus()+"-->"+beanObj.getClaimId());
        try{
             stmt = (PreparedStatement) conn.prepareStatement(query);
             stmt.setString(1,claimDetailsBean.getDustatus());
             System.out.println("ss"+claimDetailsBean.getDustatus());
             stmt.setString(2,empBeanObj.getEmpId());
              System.out.println("emp"+empBeanObj.getEmpId());

             stmt.setString(3,claimDetailsBean.getDucode());
               System.out.println("ducode"+claimDetailsBean.getDucode());









//where du_id=arr[0];


            System.out.println(query);
            stmt.executeUpdate();
        }catch(Exception e){
            e.printStackTrace();
            return "fail";
        }
        return "Success";





    }

现在 stmt.setString(3,claimDetailsBean.getDucode()); 从操作方法 value#1 获得价值我需要拆分这个(value#1)并只更新查询值。我不想要#1如何拆分和更新请任何人帮助???

4

2 回答 2

0

你可以使用子字符串

claimDetailsBean.getDucode().substring(0, claimDetailsBean.getDucode().indexOf("#"))

您可以在单独的变量中取出 claimDetailsBean.getDucode() 并在 DuCode 可以为空的情况下绝对检查空。

于 2013-06-06T06:37:59.563 回答
0

你可以简单地在java中使用split函数

public String[] split(String regex, int limit)

或者

public String[] split(String regex)
于 2013-06-06T06:25:59.000 回答