Renaming column in Android sqlite database results in error
Posted
by Apophenia Overload
on Stack Overflow
See other posts from Stack Overflow
or by Apophenia Overload
Published on 2010-06-10T03:28:46Z
Indexed on
2010/06/10
3:32 UTC
Read the original article
Hit count: 555
I've been modifying the Notepad tutorial for Android very subtly- all I did was rename the column from title
to name
:
Before:
public static final String KEY_TITLE = "title";
...
private static final String DATABASE_CREATE =
"create table notes (_id integer primary key autoincrement, "
+ "title text not null, body text not null);";
After:
public static final String KEY_TITLE = "name";
...
private static final String DATABASE_CREATE =
"create table notes (_id integer primary key autoincrement, "
+ "name text not null, body text not null);";
However, it always results in this:
06-10 03:29:38.421: ERROR/AndroidRuntime(344): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.demo.notepad1/com.android.demo.notepad1.Notepadv1}:
android.database.sqlite.SQLiteException: no such column: name: , while compiling: SELECT _id, name, body FROM notes
...
06-10 03:29:38.421: ERROR/AndroidRuntime(344): Caused by: android.database.sqlite.SQLiteException:
no such column: name: , while compiling: SELECT _id, name, body FROM notes
Am I failing to rename something? All I am modifying is the Exercise 1 Solution program from the Notepad tutorial.
© Stack Overflow or respective owner