我無法從使用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 –