Ⅰ 高手救急啊!!!如何判斷資料庫(表)中的內容為空(寫出一個語句)
/*
* 判斷表_command中是否存有命令
*/
@Override
public boolean ifExistsCommand() {
String query_sql = "select Count(*) from _command ; ";
Connection conn = DB.createConn();
PreparedStatement ps = DB.prepare(conn, query_sql);
ResultSet rs = null;
try {
rs = ps.executeQuery(query_sql);
} catch (SQLException e) {
e.printStackTrace();
}
int rows = 0;
if(null!=rs)
{
try {
while(rs.next()){
rows = rs.getInt(1);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
DB.close(ps);
DB.close(conn);
if (rows > 0) {
return true;//當查詢的結果不為空時返回true
} else {
return false;
}
}
Ⅱ 怎麼判斷資料庫的某個欄位值為空
where 欄位 is null 是判斷為null的
where 欄位=''是判斷為空