sqlite android の LIKE ステートメントに問題がありました。私は理解するのに1時間かかりましたが、エラー部分を取得できません。誰が私の間違いを知っていますか?
public Cursor getSearch(String id) {
String[] args = { id };
return (database.rawQuery("SELECT " + SQLiteHelper.product_id
+ " as _id,"
+ SQLiteHelper.productName + " ," +SQLiteHelper.productDesp
+ "," + SQLiteHelper.productQtty + ","
+SQLiteHelper.product_CategoryF+" FROM "
+ SQLiteHelper.productTable+" WHERE "
+ SQLiteHelper.productName +" LIKE 'id%'",null));
}
エラーメッセージ
bind or column index out of range: handle 0x5e3ec0
誰かが私の間違いを知っていますか?
解決
return (database.rawQuery("SELECT " + SQLiteHelper.product_id
+ " as _id,"
+ SQLiteHelper.productName + " ," +SQLiteHelper.productDesp
+ "," + SQLiteHelper.productQtty + ","
+SQLiteHelper.product_CategoryF+" FROM "
+ SQLiteHelper.productTable+" WHERE "
+ SQLiteHelper.productName +" LIKE '"+id+"%'",null));