views:

368

answers:

3

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.

A: 

Are you completely sure the db is being re-created?

I think uninstalling the app will remove the db.

Try running:

adb uninstall com.android.demo.notepad1

and then run your application again.

Macarse
Yeah, I'm sure. Reinstalling it yields the same error.
Apophenia Overload
@Apophenia Overload: Try installing http://code.google.com/p/questoidsqlitemanager/ to check what you have inside your db.
Macarse
You can use also use the adb shell and sqlite3 command to check the DB contents.
Karan
Yeah, I've been using adb. There's nothing in the table. I think the app is crashing before it can fill up the database with entries.
Apophenia Overload
A: 

name could be a reserved word ... try [name] in your query, or try a different name, something like name1 (just for testing to see if that's the reason).

aspdeveloper
A: 

Ya that is Completly Recreated...

http://blogingtutorials.blogspot.com

sawan