我有这两行,在 Eclipse ADT 中调试时,第二行会导致错误:
String[] tableColumns = new String[] {"_id","name","fruitId","vegeId","totalHours"};
Cursor cursor = db.query("PickingPeriod", tableColumns,"isDeleted = 0", null, null, null, "name" );
当我从 tableColumns 中取出“totalHours”时,它工作正常。似乎与totalHours有关,但它与fruitId和vegeId属于同一类型:INTEGER。查询可以返回超过 4 列吗?
另外,当我更改为使用 rawquery 时,一切正常:
Cursor cursor = db.rawQuery("SELECT * FROM PickingPeriod WHERE isDeleted = 0",null);
我阅读了一些建议,认为query优于rawquery,因此我想让查询正常工作。知道查询行有什么问题吗?
提前致谢