0

First of all, I tried other solutions but they didn't work for me. this is the how I create the table:

String CREATE_DETAILS_TABLE = "CREATE TABLE " + TABLE_DETAIL + "("
            + STATUS + " TEXT," + FIRST_NAME + " TEXT," + LAST_NAME + " TEXT," + EMAIL + " TEXT," + COUNTRY
            + " TEXT," + COUNTRYALPHA2 + " TEXT," + CITY + " TEXT," + ZIP + " TEXT," + ADDRESS
            + " TEXT," + USERACCSTATUS + " TEXT," + SKYPENAME + " TEXT," + COUNTRY_NAME + " TEXT," +
            PHONE_CODE + " TEXT," + PHONE + " TEXT," + DEVICEID + " TEXT," + STATUSDESC + " TEXT" + ")";
    db.execSQL(CREATE_DETAILS_TABLE);

the columns and name:

private static final String TABLE_DETAIL = "detail";

// Details table columns
private static final String STATUS = "Status";
private static final String FIRST_NAME = "FirstName";
private static final String LAST_NAME = "LastName";
private static final String EMAIL = "Email";
private static final String COUNTRY= "Country";
private static final String COUNTRYALPHA2= "CountryAlpha2";
private static final String CITY= "City";
private static final String ZIP = "Zip";
private static final String ADDRESS = "Address";
private static final String USERACCSTATUS = "UserAccStatus";
private static final String SKYPENAME = "SkypeName";
private static final String COUNTRY_NAME = "CountryName";
private static final String PHONE_CODE = "Phonecode";
private static final String PHONE = "Phone";
private static final String DEVICEID = "DeviceIdentificator";
private static final String STATUSDESC = "StatusDescription";

adding the details to the table:

public void addDetails(String status,String firstName,String lastName,String email
        ,String country,String countryAlpha2,String city,String zip,String address,String userAccStatus
,String skypename,String phonecode,String phone,String countryname,String deviceid,String statusDesc){

    SQLiteDatabase db = this.getWritableDatabase();
    ContentValues contentValues = new ContentValues();

    contentValues.put(STATUS,status);
    contentValues.put(FIRST_NAME,firstName);
    contentValues.put(LAST_NAME,lastName);
    contentValues.put(EMAIL,email);
    contentValues.put(COUNTRY,country);
    contentValues.put(COUNTRYALPHA2,countryAlpha2);
    contentValues.put(CITY,city);
    contentValues.put(ZIP,zip);
    contentValues.put(ADDRESS,address);
    contentValues.put(USERACCSTATUS,userAccStatus);
    contentValues.put(SKYPENAME,skypename);
    contentValues.put(PHONE_CODE,phonecode);
    contentValues.put(PHONE,phone);
    contentValues.put(COUNTRY_NAME,countryname);
    contentValues.put(DEVICEID,deviceid);
    contentValues.put(STATUSDESC,statusDesc);

    long id = db.insert(TABLE_DETAIL,null,contentValues);
    db.close();

    Log.d(TAG,"User Details added into sqlite: " + id);
}

and it gives me this error when trying to add the details :

android.database.sqlite.SQLiteException: table detail has no column named StatusDescription (code 1): , while compiling: INSERT INTO detail(Status,Zip,Email,Address,UserAccStatus,CountryName,FirstName,City,SkypeName,Phone,StatusDescription,Phonecode,Country,LastName,CountryAlpha2,DeviceIdentificator) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)

I'm new to all of this and if someone could help me find whats causing the problem it would be great!

Zoe
  • 27,060
  • 21
  • 118
  • 148
S.Etinger
  • 35
  • 6

1 Answers1

0

The message says you don’t have a column named StatusDescription. Are you sure the name is correct ?

Robert D. Mogos
  • 900
  • 7
  • 14