0

If I try to enter the data in the data base it show that age column in not found and the value is coming correctly I check through log....so plz tell me if any error in that code... and I am using model class for pass data...in this I mention log in which the value coming but when insert into data base then showing error... this is the error android.database.sqlite.SQLiteException: table Owner_Registration has no column named age: , while compiling: INSERT INTO Owner_Registration(login_user_name,password,location,age,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();

        }
Kevin Brechbühl
  • 4,697
  • 3
  • 25
  • 47

0 Answers0