我的应用程序数据库无效...显示(代码1)错误显示“没有这样的列”...
我的代码如下......
public static final String TABLE_PROFILE =“profile_icare”;
public static final String COL_PROFILE_NAME = "profile_name";
public static final String COL_ID = "_id";
public static final String COL_USER_NAME = "user_name";
public static final String COL_EMAIL = "email";
public static final String COL_PHONE_NO = "contact_no";
public static final String COL_AGE = "age";
public static final String COL_GENDER = "gender";
public static final String COL_BLOOD_GROUP = "blood_group";
public static final String COL_HEIGHT = "height";
public static final String COL_WEIGHT = "weight";
public static final String CREATE_TABLE_PROFILE = "CREATE TABLE "
+ TABLE_PROFILE +
"(" + COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
+ " " + COL_PROFILE_NAME + " TEXT, "
+ " " + COL_USER_NAME + " TEXT, "
+ " " + COL_EMAIL + " TEXT, "
+ " " + COL_PHONE_NO + " TEXT, "
+ " " + COL_AGE + " TEXT, "
+ " " + COL_GENDER + " TEXT, "
+ " " + COL_BLOOD_GROUP + " TEXT, "
+ " " + COL_HEIGHT + " TEXT, "
+ " " + COL_WEIGHT + " TEXT " + ");";
public static final String DROP_TABLE_QUERY = "DROP TABLE IF EXISTS " + TABLE_PROFILE;
插入方法如下:
public void addProfile(ProfileModel profileModel){
SQLiteDatabase db = getWritableDatabase();
ContentValues values = new ContentValues();
values.put(COL_PROFILE_NAME, profileModel.getFullName());
values.put(COL_USER_NAME, profileModel.getUserName());
values.put(COL_EMAIL, profileModel.geteMail());
values.put(COL_PHONE_NO, profileModel.getPhoneNo());
values.put(COL_AGE, profileModel.getAge());
values.put(COL_GENDER, profileModel.getGender());
values.put(COL_BLOOD_GROUP, profileModel.getBloodGroup());
values.put(COL_HEIGHT, profileModel.getHeight());
values.put(COL_WEIGHT, profileModel.getWeight());
db.insert(TABLE_PROFILE, null, values);
db.close();
}