2013-09-27 161 views
0

當我嘗試在我的表中插入值在抱怨ContactInfo列。它說它不存在。當我更新我的數據庫架構時,此問題開始。我試圖檢查查詢中的問題,但我似乎沒有發現任何錯誤。Sqlite數據庫錯誤列錯誤

public final static String HOSPITAL_TABLE="Hospital"; 

    public final static String HID ="ID"; 

    public final static String HOSPITALID = "HospitalID"; 

    public final static String HOSPITAL_NAME ="Name"; 

    public final static String HOSPITAL_HotLine = "HotLine"; 

    public final static String HOSPITAL_ContactLine = "ContactLine"; 

    public final static String HOSPITAL_Email = "Email"; 


public static final String CREATE_HOSPITAL_TABLE="CREATE TABLE "+HOSPITAL_TABLE+" ("+HID+" INTEGER PRIMARY KEY AUTOINCREMENT , "+HOSPITALID+" TEXT NOT NULL, "+HOSPITAL_NAME+", TEXT NULL, "+HOSPITAL_Email+" TEXT NULL, "+HOSPITAL_HotLine+" TEXT NULL, "+HOSPITAL_ContactLine+"TEXT NULL "+")"; 
+0

'ContactInfo'列?我無法在你分享的代碼上找到它......它應該在那裏嗎? – gnclmorais

+0

錯過了''TEXT'處的空格... – njzk2

回答

0

錯誤是在這裏

public static final String CREATE_HOSPITAL_TABLE="CREATE TABLE "+HOSPITAL_TABLE+" ("+HID+" INTEGER PRIMARY KEY AUTOINCREMENT , "+HOSPITALID+" TEXT NOT NULL, "+HOSPITAL_NAME+", TEXT NULL, "+HOSPITAL_Email+" TEXT NULL, "+HOSPITAL_HotLine+" TEXT NULL, "+HOSPITAL_ContactLine+"TEXT NULL "+")"; 

你使多餘的逗號醫院名稱後HOSPITAL_ContactLine後沒有給空間。因此,將上面的行改爲

public static final String CREATE_HOSPITAL_TABLE="CREATE TABLE "+HOSPITAL_TABLE+" ("+HID+" INTEGER PRIMARY KEY AUTOINCREMENT , "+HOSPITALID+" TEXT NOT NULL, "+HOSPITAL_NAME+" TEXT NULL, "+HOSPITAL_Email+" TEXT NULL, "+HOSPITAL_HotLine+" TEXT NULL, "+HOSPITAL_ContactLine+" TEXT NULL "+")";