conn = TransactionManager.getConnection();
            pstmt = conn.prepareStatement(sb.toString());
            pstmt.setString(1,newLoginName);
            pstmt.setString(2,StringUtil.hash(newPassword));
            pstmt.setString(3,newName);
            pstmt.setString(4,newEmalAddress);
            pstmt.setString(5,StringUtil.dateToMillis(new Date()));
            pstmt.setString(6,oldLoginName);
            pstmt.execute();

解决方案 »

  1.   

    conn = TransactionManager.getConnection(); 取得数据库连接
                pstmt = conn.prepareStatement(sb.toString());建立prepareStatement
                pstmt.setString(1,newLoginName);给SQL语句赋值
                pstmt.setString(2,StringUtil.hash(newPassword));
                pstmt.setString(3,newName);
                pstmt.setString(4,newEmalAddress);
                pstmt.setString(5,StringUtil.dateToMillis(new Date()));
                pstmt.setString(6,oldLoginName);
                pstmt.execute(); 执行SQL
      

  2.   

    那这段代码有什么毛病么 已经提交了啊 
    StringBuffer sb = new StringBuffer();
            sb.append("UPDATE Lex_User ");
            sb.append(" SET change_pass_time = "+d);
            sb.append(" WHERE login_name = '"+loginname+"'");
            Connection conn = null;
            PreparedStatement pstmt = null;
            System.out.println(sb.toString());
            System.out.println(d);
            System.out.println(loginname);
            try {
                conn = TransactionManager.getConnection();
                pstmt = conn.prepareStatement(sb.toString());
                conn.commit();
            } catch (SQLException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
                throw new SystemException("Database operation error!");
            }
      

  3.   

    pstmt.execute(); 执行SQL..............
      

  4.   

    晕了 提交了 也执行了 可是还是没有用
    StringBuffer sb = new StringBuffer();
            sb.append("UPDATE Lex_User ");
            sb.append(" SET change_pass_time = "+d);
            sb.append(" WHERE login_name = '"+loginname+"'");
            Connection conn = null;
            PreparedStatement pstmt = null;
            try {
                conn = TransactionManager.getConnection();
                pstmt = conn.prepareStatement(sb.toString());
                conn.commit();
                pstmt.execute();
            } catch (SQLException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
                throw new SystemException("Database operation error!");
            }
      

  5.   

    先执行再提交。汗啊
    conn = TransactionManager.getConnection();
                pstmt = conn.prepareStatement(sb.toString());
                
                pstmt.execute();conn.commit();
      

  6.   

    pstmt 是 prepareStatement类型的,prepareStatement执行的是预编译sql语句
    比如:sql = "select * from xxx where id = ?";
    pstmt.setString(1,xx);//用值替换问号
    ResultSet rs = pstmt.execute();//执行
    好象是这么个意思,好久不用预编译了
      

  7.   

    你的想法就应该用Statement啊~~
      

  8.   

    执行SQl语句
    看看jsp应用开发详解