0

当我尝试在我的表中插入值时抱怨 ContactInfo 列。它说它不存在。当我更新我的数据库模式时,这个问题就开始了。我试图检查查询中的问题,但我似乎没有发现任何错误。

    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 "+" )";
4

1 回答 1

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 "+" )";
于 2013-09-27T10:14:58.760 回答