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日
最近浏览更多
pangzhihui LV11
3月1日
晴曛 LV6
2月20日
123456wadff LV3
1月15日
WBelong LV6
2023年12月27日
asddwh LV12
2023年12月26日
hxy19991216 LV4
2023年12月23日
Henew168 LV2
2023年11月19日
2749263182
2023年11月12日
暂无贡献等级
dsadasdwf LV12
2023年10月23日
fesfefe LV13
2023年10月10日