2012-11-12 47 views
1

請幫助我。我得到這個錯誤:SQLiteException:near/TABLE_NAME /:語法錯誤

Caused by: android.database.sqlite.SQLiteException: near "values": syntax error: CREATE TABLE values (_id INTEGER PRIMARY KEY AUTOINCREMENT, name text, caption text, lines integer , photo_url text, type text); 

這裏是我想創建數據庫表:

private static final String TABLE_VALUES_CREATE = 
    "CREATE TABLE " + DATABASE_TABLE_VALUES + 
      " (_id INTEGER PRIMARY KEY AUTOINCREMENT, " 
      + ValueTemplate.KEY_NAME + " text, " 
      + ValueTemplate.KEY_CAPTION + " text, " 
      + ValueTemplate.KEY_LINES + " integer , " 
      + ValueTemplate.KEY_PHOTOURL + " text, " 
      + ValueTemplate.KEY_TYPE + " text);"; 

    //ValueTemplate class: 
    // VALUE TEMPLATES 

     public static final String KEY_CAPTION = "caption"; 
     public static final String KEY_NAME = "name"; 
     public static final String KEY_TYPE = "type"; 
     public static final String KEY_LINES = "lines"; 
     public static final String KEY_PHOTOURL = "photo_url"; 

回答

4

我想是因爲(值)是保留名稱,重命名錶..

+0

謝謝。這解決了我的問題 – user1766287

2

如果你堅持保留完全相同的表名,然後嘗試[values] ,否則最好的將它重命名爲tblValues