2
我用下面的方法來從表中獲取數據:如何使用rawquery方法在Android中使用SQLite對行進行排序?
Cursor c = ourDatabase.rawQuery("SELECT " + KEY_SWIMMERLAPS + " * "
+ KEY_SPONSOR + " AS result FROM " + DATABASE_TABLE, null);
我想知道這是否可以通過KEY_SWIMMERLAPS編輯以排序結果。我想下面將工作:
Cursor c = ourDatabase.rawQuery("SELECT " + KEY_SWIMMERLAPS + " * "
+ KEY_SPONSOR + " AS result FROM " + DATABASE_TABLE, KEY_SWIMMERLAPS + " DESC");
不過,我得到一個錯誤,因爲KEY_SWIMMERLAPS不是字符串:
方法rawQuery(字符串,字符串[])在類型SQLiteDatabase不適用參數(字符串,字符串)
在這裏發佈完整的錯誤/異常消息。 –