0

这是错误

android.database.sqlite.SQLiteException:靠近“FROMfriendsWHERE”:语法错误:,编译时:SELECT * FROMfriendsWHERE id!=?

这是我的代码

Cursor cursor = db.rawQuery("SELECT * FROM "+FriendsDBHelper.TABLE_NAME+" WHERE id != ?",new String[]{Integer.toString(0)});
4

1 回答 1

0

尝试

Cursor cursor = db.rawQuery("SELECT * FROM "+FriendsDBHelper.TABLE_NAME+" WHERE id NOT LIKE ?",new String[]{Integer.toString(0)});

NOT LIKE是用来do not have ? value in it

或者

Cursor cursor = db.rawQuery("SELECT * FROM "+FriendsDBHelper.TABLE_NAME+" WHERE id <> ?",new String[]{Integer.toString(0)});

<>是用来is not equal to ?

于 2013-08-21T08:51:00.050 回答