2012-02-12 52 views
1

我想運行一個使用sqllite的選擇。它是我第一次使用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; 
} 

錯誤:

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

回答