2012-04-05 184 views
-1

我寫了一個查詢值插入在Android的數據庫:插入到數據庫

db.execSQL("CREATE TABLE " + TABLE_NAME + "(" + KEY_SITUATION_NAME 
     + " TEXT NOT NULL, " + KEY_CATEGORY_NAME + " TEXT NOT NULL," 
     + KEY_LATTIUDE +" NOT NULL," + KEY_LONGITUDE + " NOT NULL," + ");"); 

然而,當我執行它,則會引發錯誤。任何人都可以指出它的錯誤嗎?

+0

什麼錯誤ü[R獲得,其中用於插入的代碼? – 2012-04-05 04:10:05

+0

它拋出了什麼錯誤?請發佈在日誌貓的錯誤,以便我們可以幫助你。 – deepa 2012-04-05 04:10:13

回答

0
db.execSQL("CREATE TABLE " + TABLE_NAME + "(" + KEY_SITUATION_NAME 
      + " TEXT NOT NULL, " + KEY_CATEGORY_NAME + " TEXT NOT NULL," 
      + KEY_LATTIUDE +" NOT NULL," + KEY_LONGITUDE + " NOT NULL);"); 
0

正確的代碼是:

db.execSQL("CREATE TABLE " + TABLE_NAME + "(" + KEY_SITUATION_NAME 
     + " TEXT NOT NULL, " + KEY_CATEGORY_NAME + " TEXT NOT NULL," + KEY_LATTIUDE +" NOT NULL," + KEY_LONGITUDE + " NOT NULL," + ")"); 
1
db.execSQL("CREATE TABLE " + TABLE_NAME + "(" + KEY_SITUATION_NAME 
    + " TEXT NOT NULL, " + KEY_CATEGORY_NAME + " TEXT NOT NULL," 
    + KEY_LATTIUDE +" INTEGER NOT NULL," + KEY_LONGITUDE + " INTEGER NOT NULL" + ");"); 

提供一個數據類型來KEY_LATITUDE和KEY_LONGITUDE。

,你也始終保持着()最後這是沒有必要......