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
This can happen when you are trying to insert the data into the table where the column name does not exist or maybe schema that you are trying to insert into has been changed with the latest sequelize.js code.
Possible issue Examples:
ID
and now UUID
)IDS
: 1234) into the table with the column name (eg: ID
: 1234)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();
}
}
For others who are having problems with this SQLite error, it appears that it was due in my case to having duplicate column names as pointed out by CL to my post. When I corrected that and reran the code, it worked fine, no error.
So, make sure that your column names are correct for your insert statement.