首页>代码>JSP开发企业办公自动化管理系统源代码下载>/备忘录模块/12/src/com/dao/UserDAO.java
package com.dao;

import com.model.UserForm;

import com.tools.ConnDB;

import java.sql.*;

public class UserDAO {
	private ConnDB conn;

	public UserDAO() {
		conn = new ConnDB();
	}

	//验证用户的方法,返回为1表示登录成功,否则表示登录失败
	public int login(UserForm m){
        int flag = 0;
        String sql = "SELECT * FROM tb_user where userName='" +
                     m.getUserName() + "'";
        ResultSet rs = conn.executeQuery(sql);
        try {
            if (rs.next()) {
                String pwd = m.getPwd();
                System.out.println("密码:"+pwd);
                if (pwd.equals(rs.getString(3))) {
                    flag = 1;
                    rs.last();
                    int rowSum = rs.getRow();
                    rs.first();
                    if (rowSum != 1) {
                        flag = 0;
                        System.out.print("获取的row的值:" + sql + rowSum);
                    }
                } else {
                    flag = 0;
                }
            }else{
                flag = 0;
            }
        } catch (SQLException ex) {
            flag = 0;
        }
        return flag;
	}
}
最近下载更多
ming_123_9715  LV23 2023年3月6日
dasdascccf  LV10 2022年6月16日
eniu_27  LV5 2022年5月30日
jinglang  LV11 2022年5月8日
Start1  LV15 2021年10月30日
天66666  LV6 2021年5月30日
Hitomi1  LV2 2021年5月26日
freeblow  LV2 2021年5月20日
nitama  LV19 2021年5月14日
晚春的树和书  LV6 2021年4月30日
最近浏览更多
pilatecna 2月5日
暂无贡献等级
chinajy  LV2 2024年12月8日
gxh999810  LV1 2024年11月30日
微信网友_7044194812350464  LV8 2024年9月13日
krispeng  LV14 2024年8月12日
sunlea  LV20 2024年5月9日
pangzhihui  LV14 2024年3月1日
晴曛  LV6 2024年2月20日
123456wadff  LV3 2024年1月15日
WBelong  LV8 2023年12月27日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友