Good day friends. I am developing simple search function on my android project.I am using the 'like %selectionArgs%' in my query but I always get error like this (1) near "s": syntax error.
This is my code for that function:
public Cursor getWord(String[] selectionArgs){
String selection = FIELD_NAME + " like ? ";
if(selectionArgs!=null){
selectionArgs[0] = "%" + selectionArgs[0] + "%";
}
SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
queryBuilder.setProjectionMap(mAliasMap);
queryBuilder.setTables(TABLE_NAME);
Cursor c = queryBuilder.query(mDictionaryDBOpenHelper.getReadableDatabase(),
new String[] { FIELD_ID,
SearchManager.SUGGEST_COLUMN_TEXT_1 ,
SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID } ,
selection,
selectionArgs,
null,
null,
FIELD_NAME + "asc",
"10"
);
return c;
}
Aucun commentaire:
Enregistrer un commentaire