当我尝试在我的表中插入值时,抱怨ContactInfo列。它说它不存在。当我更新我的数据库schemmas时,这个问题就开始了。我试图检查查询中的问题但我似乎没有发现任何错误。
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 :(得分: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 "+" )";