小编Mar*_*ark的帖子

使用selectionArgs在查询中不起作用

我正在尝试使用以下内容:

String dbquery = "Select * From stops where stopname LIKE '%?%' LIMIT 100";
String[] uinputarray = {uinput};
Cursor c = sDB.rawQuery(dbquery, uinputarray);
Run Code Online (Sandbox Code Playgroud)

这种情况一直在崩溃.

奇怪的是,如果我使用旧的测试代码:

Cursor c = sDB.rawQuery("Select * From stops where stopname LIKE '%" + uinput + "%' LIMIT 100", null);
Run Code Online (Sandbox Code Playgroud)

它完美无瑕.

我一直在阅读selectionArgs,老实说我看不出有什么问题.

我究竟做错了什么?

多谢你们

sqlite android

4
推荐指数
1
解决办法
1273
查看次数

标签 统计

android ×1

sqlite ×1