菜鸟问题:jsp如何判断数据库返回值为空

kes2000 2003-04-25 10:50:49
Connection conn=DriverManager.getConnection(sConnStr,sUser,sPassword);
Statement stmt=conn.createStatement() ;
ResultSet rs=stmt.executeQuery(sql);
我用while(rs.next())这种形式已经能读了,现在我想问的问题是:
在用户认证中,如果sql语句查出的是一条空值的话,rs应该如何判断来获得?

...全文
84 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
zdsxj2002 2003-04-25
  • 打赏
  • 举报
回复
if(rs.getString("fieldName") != null && !rs.getString("fieldName").equals("")){
//当取值不为空时
}else{
//当取值为空时
};
小米儿mikko 2003-04-25
  • 打赏
  • 举报
回复
if(rs.next())
{
执行操作.....
}else
{
执行操作
}

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧