这样的条件该怎么写?

Mszzc 2003-03-04 05:17:54

String s;

Connection cn = DriverManager.getConnection(url,user,password);
Statement st = cn.createStatement();
ResultSet rs = st.executeQuery("select name from table");


如果我要判断 s 在不在rs中,应该怎么写呢?
...全文
32 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
takecare 2003-03-04
  • 打赏
  • 举报
回复
while (rs.next())
{
if (rs.getString(1).equals(s))
return true;
}
return false;
takecare 2003-03-04
  • 打赏
  • 举报
回复
select 1 from table where name = s
takecare 2003-03-04
  • 打赏
  • 举报
回复
select "exist" from table where name like "%s%"

81,092

社区成员

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

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