日期:2014-05-17 浏览次数:21087 次
try
        {
            String sql = "select count(*) from users where userName=? and userPwd=?";
            prepar = conn.prepareStatement(sql);
            prepar.setString(1, userName);
            prepar.setString(2, userPwd);
            res = prepar.executeQuery();
            if (res.next())
            {
                if (res.getInt(1) > 0)
                {
                    useBean = this.getUser(userName);
                }
                else
                {
                    useBean = null;
                }
            }
            else
            {
                useBean = null;
            }
        }
        catch (Exception e)
        {
            useBean = null;
            e.printStackTrace();
        }