New*_*ser 1 sqlite android targetnullvalue
我在使用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
}
}
Run Code Online (Sandbox Code Playgroud)
有些人可以根据我的例子提供一个工作代码,我的表中有第9列和第10列.
简要说明也将受到欢迎.谢谢