我正在执行一个 SQLite 查询:
String selectQuery = "SELECT hotel.cityName, hotel.hotelName, hotel.roomName, hotel.roomCode, hotel.roomType, hotel.maxPax FROM hotel WHERE ( hotel.cityName = 'Adelaide' OR hotel.cityName = 'Brisbane' OR hotel.cityName = 'Canberra' ) AND hotel.maxPax < 200 AND hotel.maxPax >= 100 AND ( hotel.roomType = 'Boardroom' )"
针对从 XML 创建的名为“hotel”的数据库表,具有以下标题(根据 DDMS):
id (INT)
cityName (TEXT)
hotelName (TEXT)
roomCode (TEXT)
roomName (TEXT)
roomType (TEXT)
maxPax (INT)
每次我运行查询时:
SQLiteDatabase db = this.getWritableDatabase ( );
Cursor cursor = db.rawQuery ( selectQuery, null );
cursor.getCount() 返回 0。
我检查了实际数据,这个查询肯定会返回数据。为什么 cursor.getCount() 返回 0?