如果我尝试在数据库中输入数据,则显示未找到年龄列且值正确,我检查日志....所以请告诉我该代码中是否有任何错误...和我正在使用模型类来传递数据...在这里我提到了日志,其中值即将插入到数据库然后显示错误...这是错误android.database.sqlite.SQLiteException:table Owner_Registration没有列命名年龄:,同时编译:INSERT INTO Owner_Registration(login_user_name,密码,位置,年龄,名称)VALUES(?,?,?,?,?)
public void onCreate(SQLiteDatabase db) {
String CREATE_REGISTER_TABLE= "CREATE TABLE " + TABLE_NAME + "("
+ PRIMARY_KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT ," + OWNER_NAME
+ " TEXT," + OWNER_AGE + " INTEGER,"
+ OWNER_LOCATION + " TEXT," + OWNER_USER_NAME
+ " TEXT," + OWNER_PASSWOED + " TEXT" + ")";
db.execSQL(CREATE_REGISTER_TABLE);
}
public void Add_Owner_Registration_Data(Owner_Registration_Model_Class model){
SQLiteDatabase db=this.getWritableDatabase();
ContentValues value=new ContentValues();
value.put(OWNER_NAME, model.getName());
value.put(OWNER_AGE, model.getAge());
Log.i("age values",""+ model.getAge());
value.put(OWNER_LOCATION, model.getLocation());
value.put(OWNER_USER_NAME, model.getUsername());
value.put(OWNER_PASSWOED, model.getPassword());
db.insert(TABLE_NAME, null, value);//hear is error
db.close();
}