2012-02-12 7 views
1

sqllite를 사용하여 select를 실행하려고합니다. 처음으로 sqllite를 사용하여이 오류가 계속 발생합니다.sqlite에서 선택 실행

기능 = "추가 이벤트

CODE :

public List<Example> getExampleByFunctionList(String function) 
{ 
    List<Example> examplelist = new ArrayList<Example>(); 
    String getQuery = "SELECT * FROM " + MySQLiteHelper.TABLE_EXAMPLE+ 
     " where "+ MySQLiteHelper.COLUMN_EXAMPLE_FUNCTION +" = "+""+function+""; 
    Cursor cursor = database.rawQuery(getQuery, null); 
    cursor.moveToFirst(); 
    while (!cursor.isAfterLast()) { 
     Example example = cursorToExample(cursor); 
     examplelist.add(example); 
     cursor.moveToNext(); 
    } 
    cursor.close(); 
    return examplelist; 
} 

ERROR :

02-12 12:37:29.218: E/AndroidRuntime(3165): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tutorial/com.tutorial.ManageCalendar}: android.database.sqlite.SQLiteException: near "Events": syntax error: , while compiling: SELECT * FROM example where examplefunction = Adding Events
당신은 상관없이 공백을 포함하는지 여부 (SQL 문에서 문자열 리터럴을 인용 할 필요가

답변