2011-11-01 6 views
0

내 응용 프로그램에서 데이터베이스의 일부 패턴을 검색하고 싶습니다. 하지만 내 DB 쿼리가 작동하지 않습니다. "%"근처에 구문 오류가 있습니다 : 컴파일 중 : SELECT _id, note Notes에서 note = %?SQLite 쿼리에서 메타 문자를 사용하는 방법

public Cursor getAll(String id) { 
     String[] args = { id }; 
     return (getReadableDatabase().rawQuery(
       "SELECT _id,city From City Where city=%?%", args)); 
    } 

답변

0

public Cursor getAll(String id) { 
     return (getReadableDatabase().rawQuery(
       "SELECT _id,city From City Where city like '%" + id + "%'", null)); 
    } 
시도
관련 문제