草庐IT

Android SQLiteException : bind or column index out of range problem

coder 2023-06-08 原文

在 android 中我使用以下语句。

model = dataHelper.rawQuery("SELECT _id, engword, lower(engword) as letter FROM word WHERE letter >= 'a' AND letter < '{' AND engword LIKE '%" + filterText + "%'", new String[ {"_id","engword", "lower(engword) as letter"});

它正在抛出 android.database.sqlite.SQLiteException: bind or column index out of range: handle 0x132330

我的代码有什么问题?

最佳答案

正确的说法是:

model = dataHelper.rawQuery("
    SELECT _id, engword, lower(engword) as letter
    FROM word W
    HERE letter >= 'a'
    AND letter < '{'
    AND engword LIKE ? ORDER BY engword ASC
    ",
    new String[] {"%" + filterText + "%"}
);

关于Android SQLiteException : bind or column index out of range problem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5716543/

有关Android SQLiteException : bind or column index out of range problem的更多相关文章

随机推荐