社区
Web 开发
帖子详情
谁有登录bean?Give me
javawriter
2003-01-27 04:54:05
要实现判断1有无用户,2密码是否正确,3登录日期,4登录次数
...全文
12
5
打赏
收藏
谁有登录bean?Give me
要实现判断1有无用户,2密码是否正确,3登录日期,4登录次数
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
5 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
9soul
2003-01-28
打赏
举报
回复
呵呵:)
lsj_smile
2003-01-27
打赏
举报
回复
if (!rs.next())
{
//返回没有此用户!
this.message = "-2";
}
while(rs.next()){
loginTimes = rs.getInt("logintimes");
trueName = rs.getString("true_name");
pwd1 = rs.getString("login_pass");
System.out.print(loginTimes);
}
因为你用了两个next,导致已经定位到记录后面去了,所以得不到值,应该为
if (!rs.next())
{
//返回没有此用户!
this.message = "-2";
}
else{
do{
loginTimes = rs.getInt("logintimes");
trueName = rs.getString("true_name");
pwd1 = rs.getString("login_pass");
System.out.print(loginTimes);
}while(rs.next());
}
javawriter
2003-01-27
打赏
举报
回复
错在哪了?
javawriter
2003-01-27
打赏
举报
回复
public int getLoginTimes(){
String sql = null;
String pwd1 = null;
try{
conn = DriverManager.getConnection(dbURL,dbLogin,dbPassword);
Statement stmt = conn.createStatement();
sql = "Select logintimes,true_name,login_pass from user_table where login_name='"+loginId+"'";
rs = stmt.executeQuery(sql);
if (!rs.next())
{
//返回没有此用户!
this.message = "-2";
}
while(rs.next()){
loginTimes = rs.getInt("logintimes");
trueName = rs.getString("true_name");
pwd1 = rs.getString("login_pass");
System.out.print(loginTimes);
}
if (pwd1.equals(passWord)){
//密码错误
this.message = "-1";
}
rs.close();
if(loginTimes!=-1){
sql = "Update user_table set logintimes = logintimes + 1 where login_name = '"+loginId+"'";
stmt.executeUpdate(sql);
}
stmt.close();
conn.close();
}catch(SQLException e){
e.printStackTrace();
}
return loginTimes;
}
提示:
nullpointException
mechiland
2003-01-27
打赏
举报
回复
不会吧,这都要人帮你写?
11. 音标讲解教程.doc
Keys/ kiss Give me a kiss for the keys. Feet/ fit These shoes fit my feet. Peel/ pill Don’t peel that pill. Sheep/ ship There are sheep on the ship. These/ this These are better than this one. Deed/...
Spring源码之Spring是怎么创建
Bea
n的?
在首次启动容器的时候,必然会进入Create
Bea
n,所以这里直接采用DeBUG的方式追踪源码。 启动Spring容器之前在方法上打上断点。 调试出来自己认识的
Bea
n step into 创建
Bea
n的主要做以下几件事情。...// Prepare me.
[每天读一点英文:那些给我勇气的句子]:Are you a Carrot, an Egg or Coffee
Bea
n?
A young woman went to her mother and told her about her life, and howthings were so hard for her. She did not know how she was going to makeit, and wanted to give up. She was tired of
java
bea
n状态,无状态和有状态的企业Java
Bea
n
Can somebody give me a simple hello world type example of a stateless session
bea
n that behaves differently when you change it to stateful? 解决方案 The important difference is not private member ...
Spring源码阅读3-
bea
n获取-上
继续前面的话题,当我们已经将
bea
n的定义从xml文件获取到容器后(包括使用注解的自动扫描),下面要进行的就是
bea
n的获取了。现在我们的容器拥有了
bea
n的所有信息,包括类型,class对象,属性参数,单例or原型,初始...
Web 开发
81,095
社区成员
341,711
社区内容
发帖
与我相关
我的任务
Web 开发
Java Web 开发
复制链接
扫一扫
分享
社区描述
Java Web 开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章