我是 android 编程的初学者,我在尝试插入我的 sqlite 数据库时遇到了这个错误。
sqlite 返回:错误代码 =1,msg = 表 MobileHouseVisit 没有列 Elder_date_time。
对于前 3 列,在我添加更多列之前没有问题。这就是我评论它的原因。我检查了间距,一切看起来都很好。我用谷歌搜索了它,但仍然没有任何帮助。
下面是我的代码
private static final String DATABASE_NAME = "silverCareMgt.db";
private static final String DATABASE_TABLE = "MobileHouseVisit";
private static final int DATABASE_VERSION = 1;
private SQLiteDatabase _db;
private final Context context;
public static final String MOBILE_HOUSE_VISIT_ID = "_id";
public static final int COLUMN_KEY_ID = 0;
public static final String ELDERLY_NAME = "elderly_name";
public static final int COLUMN_NAME_ID = 1;
public static final String ELDERLY_NRIC = "elderly_nric";
public static final int COLUMN_TEL_ID = 2;
public static final String ELDERLY_DATE_TIME = "elderly_date_time";
public static final int COLUMN_DT_ID = 3;
//public static final String PHYSICAL_HEALTH_STATUS ="physical_health";
//public static final int COLUMN_PHY_ID = 4;
//public static final String MENTAL_HEALTH_STATUS ="mental_health_status";
//public static final int COLUMN_MENTAL_ID = 5;
protected static final String DATABASE_CREATE = "create table " + DATABASE_TABLE +" ("+
MOBILE_HOUSE_VISIT_ID + " integer primary key autoincrement, "+
ELDERLY_NAME + " TEXT NOT NULL, "+
ELDERLY_NRIC + " TEXT NOT NULL, " +
ELDERLY_DATE_TIME + " TEXT NOT NULL);";
//+ PHYSICAL_HEALTH_STATUS + " TEXT, "
//+ MENTAL_HEALTH_STATUS + " TEXT);";