반응형

출처:

http://stackoverflow.com/questions/10598137/rawqueryquery-selectionargs

http://stackoverflow.com/questions/5716543/android-sqliteexception-bind-or-column-index-out-of-range-problem


안드로이드에서 rawQuery()는 SQL 쿼리를 실행시키는 메소드이다.

이 함수는 이렇게 사용한다.


rawQuery("select * from table", null);

조건 값이 있는 경우에는 다음과 같이 사용한다..


rawQuery("select * from table where 조건명 = ?", new String[] {"%" + 조건값 + "%"});

컬럼명도 유동적인 경우에는 다음과 같이 한다.


rawQuery("select * from table where " + 조건명 + " = ?", new String[] {"%" + 조건값 + "%"});
반응형
Posted by 애콜라이트
l

free counters