Android & SQLite: "Table audios has no column named downloaded"
- by Erik
I get this weird exception when i run my app on both the emulator and a USB connected device. i can see the table inside the shell, but when I try to insert a record from the Activity acton I get this exception:
android.database.sqlite.SQLiteException: table audios has no column named downloaded
I am mostly running on an emulator with Android 1.5. The predominant part of my code is linked to this tutorial - http://www.devx.com/wireless/Article/40842/1954.
This is the create statement I use:
private static final String DATABASE_CREATE =
"create table audios ( _id integer primary key autoincrement, "
+ "user_name text not null, title text not null, file_path text not null, download integer not null, "
+ "created_at integer not null, downloaded_at integer not null );";
This is the insert code I use:
//--- insert a title into the database ---
public long insertTitle(String user_name, String title, String file_path, Integer downloaded, long created_at, String downloaded_at ) {
ContentValues initialValues = new ContentValues();
initialValues.put(KEY_USER_NAME, user_name);
initialValues.put(KEY_TITLE, title);
initialValues.put(KEY_FILE, file_path);
initialValues.put(KEY_DOWNLOADED, downloaded);
initialValues.put(KEY_CREATED_AT, created_at);
initialValues.put(KEY_DOWNLOADED_AT, downloaded_at);
return db.insert(DATABASE_TABLE, null, initialValues);
}