tags:

views:

90

answers:

2

I had a working database. I just added one more column in a table. It keeps saying no that column. So I changed the table name. Now it says that no that table name. Then I changed the database name. it still gave error. it works fine after I changed back the table name and remove the extra column I added. Could you please help me figure out what's wrong? How do I run my code on a clean emulator? How do I verify that the code that creates the table is getting executed? How do I get the sqlite db off the emualtor and look at it using a sqlite database browser to check that the table does actually exist?

Many thanks! Tong

A: 

In real world, you'll have to change database version and migrate changes in onUpgrade(..).
When developing, you can check "Wipe User Data" in Eclipse's run configuration for you project, then close emulator and launch app again.

alex
Thank you Alex! I still get the same message. No column names.... Could you please explain how the following code works. I could name my database DBV1 and DBV2. But how the Eclipse reconginze the different versions? public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS records"); onCreate(db); }
Tong
A: 

I found the mistake. I missed the comma after I added the last column. Simple mistake could cost a lot.

Tong