Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以使用 rs.getboolean 方法从 SQL 中获取 tinyint(0/1) 的值?像这样:
while (rs.next()) { boolean noUse= rs.getBoolean(1); }
如果这不起作用,我想你必须做这样的事情:
while (rs.next()) { boolean noUse= rs.getByte(1)==1; }
谢谢你的协助。
选项 1 应该可以正常工作,我也使用过。
在 mysql 中,tinyint 充当布尔值(但将物理值保存为 0/1)执行上述代码时,
如果字段值 = 0 则;noUse=false else if field value= 1 then ; 不使用=真