On Jan 20, 1:11 am, Magic <[email protected]> wrote: > I need a little help updating my database. I created an app that has > an embedded database. When you first install the app it creates the > database fine and works great, but when I do an update, change the > database version the app crashes. I looked all over to see if there > was a line of code I needed to place in the manifest but I could fine > any. I have posted the database code below, any help would be > appreciated. > > public class EventsData extends SQLiteOpenHelper { > private static final String DATABASE_NAME = "tmidata.db"; > private static final String DATABASE_TABLE_S = "setting"; > private static final String DATABASE_TABLE_E = "event"; > private static final int DATABASE_VERSION = 3; > SQLiteDatabase db; > /** Create a helper object for the Events database */ > public EventsData(Context ctx) { > super(ctx, DATABASE_NAME, null, DATABASE_VERSION); > } > > �...@override > public void onCreate(SQLiteDatabase db) { > db.execSQL("Create table setting(area TEXT,notify TEXT,time TEXT, > topic TEXT)"); > db.execSQL("Create table events(_id TEXT,brief TEXT,category1 > TEXT, category2 TEXT, day TEXT,image TEXT,imagename TEXT,information > TEXT, month TEXT, name TEXT, year TEXT)"); > db.execSQL("Create table notify(today TEXT)"); > db.execSQL("insert into notify(today) values('n/a')"); > db.execSQL("insert into setting(area,notify,time,topic) values('n/ > a','n/a','n/a','n/a')"); > db.execSQL(Database.SQL); > db.execSQL(Database.SQL1); > db.execSQL(Database.SQL2); > } > > �...@override > public void onUpgrade(SQLiteDatabase db, int oldVersion, int > newVersion) { > db.execSQL("DROP TABLE IF EXISTS event"); > onCreate(db); > > } > > > > }
I notice that you are dropping table 'event' but creating table 'events' plural. Perhaps that is part of the problem.
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

