日期:2014-05-18  浏览次数:20637 次

请问为什么在jsp中无法访问值为null
sql="select devicenum from e8_device where idle=null' "
ResultSet rs= a.executeQuery(sql);
if (rs.next()) {
...
}
 系统总是找不到
不知道这是为什么

------解决方案--------------------
sql 中不能用=null 来判断是否为空 要用 is null

"select devicenum from e8_device where idle is null'"

------解决方案--------------------
用 is null
------解决方案--------------------
无错,在SQL中,判断是否为null,要用 where 字段 is null ,不能用 where 字段 = null