我无法从使用Android的SQLite数据库中获取空值。如何从Android中的SQLite数据库获得空值
我的数据库有10列。从第1列到第8列,所有数据都填入数值。但有几列的第9列和第10列的值为空或某个数字。
我要检查:根据我在我的表列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
}
}
能有人提供了一个工作代码。
简单的解释也将受到欢迎。 谢谢
欢迎来到stackoverflow –