我无法使用 Android 从 SQLite 数据库获取空值。
我的数据库有 10 列。从第 1 列到第 8 列都填充了值。但是有几行第 9 列和第 10 列中的值为空或某个数字。
我想检查:
String selectQuery = "SELECT * FROM products WHERE barcodeId='" + id + "'";
Cursor myCursor = db.rawQuery(selectQuery, null);
if (myCursor.moveToFirst()) {
//checking to see if there is something in column 9
if(myCursor.getString(8) != null){
// do soemthing
}else {
// if there is nothing do something
}
//checking to see if there is something in column 10
if(myCursor.getString(9) != null){
// do soemthing
}else {
// if there is nothing do something
}
}
有人可以根据我的示例在我的表中的第 9 列和第 10 列中提供工作代码吗?
一个简短的解释也将受到欢迎。谢谢