Problems inserting to database for android app
When I trying to insert into my database I keep getting ERRORS listed below:
08-14 11:50:21.455: E/SQLiteLog(27688): (1) table exercises has no column
named reps
08-14 11:50:21.495: E/SQLiteDatabase(27688): Error inserting reps=4 title=
BarBell Curls weight=4 notes=db date=August-14-2013
08-14 11:50:21.495: E/SQLiteDatabase(27688):
android.database.sqlite.SQLiteException: table exercises has no column
named reps (code 1): , while compiling: INSERT INTO
exercises(reps,title,weight,notes,date) VALUES (?,?,?,?,?)
Here is what I have for creation statement:
//Database creation sql statement
private static final String DATABASE_CREATE = "create table " +
DATABASE_TABLE + " (" + KEY_ROWID + " integer primary key autoincrement, "
+ KEY_TITLE + " text not null, "
+ DATE_SELECTED + " text not
null, "
+ WEIGHT_INPUT + " text not
null, "
+ REPS_INPUT + " text not null, "
+ KEY_BODY + " text not null"
+ ");";
//method to insert row
public long createExercise(String title, String date, String weight,
String reps, String body)
{
ContentValues initialValues = new ContentValues();
initialValues.put(KEY_TITLE, title);
initialValues.put(DATE_SELECTED, date);
initialValues.put(WEIGHT_INPUT, weight);
initialValues.put(REPS_INPUT, reps);
initialValues.put(KEY_BODY, body);
return myDatabase.insert(DATABASE_TABLE, null, initialValues);
}
I know I am just missing something simple and any help would be greatly
appreciated! Cheers
No comments:
Post a Comment