SQLite column error: table XXX has no column named YYY

前端 未结 3 570
逝去的感伤
逝去的感伤 2021-01-29 07:47

I\'ve looked at the following, among others and have found nothing that matches my problem (as far as I can tell):

android.database.sqlite.SQLiteException: table X has n

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-29 08:07

    Looks like your values variable already have that value inside the object, check this :

    public void addVetInfo(String name, String address1, String address2, String city, String state, String zip, String phone, String email){
        try {
            db = this.getWritableDatabase();
            //INITIALIZE YOUR VARIABLE VALUES HERE
            ContentValues values = new ContentValues();
    
        //if(name == "Enter vet name") name = null;
        values.put(VET_NAME, name);
        //if(address1 == "Enter address 1" || address1 == " ") address1 = null;
        values.put(ADDRESS1, address1);
        //if(address2 == "Enter address 2") address2 = null;
        values.put(ADDRESS2, address2);
        //if(city == "Enter city") city = null;
        values.put(CITY, city);
        //if(state == "Enter state") state = null;
        values.put(CITY, state);
        //if(zip == "Enter zip") zip = null;
        values.put(ZIP_CODE, zip);
        //if(phone == "Enter phone number") phone = null;
        values.put(PHONE_NUMBER, phone);
        //if(email == "Enter email address") email = null;
        values.put(EMAIL_ADDRESS, email);
        db.insert(TABLE_VETS, null, values);
    } catch (SQLException e) {
        e.printStackTrace();
    }
    }
    

提交回复
热议问题