0
我有一个示例Android应用程序,我在其中创建了一个数据库,创建了一个表,然后将数据插入表中。第二天,在打开Eclipse IDE并通过模拟器运行我的应用程序时,应用程序突然关闭,SQLLiteException声称No such table
。android.database.sqlite.SQLiteException:没有这样的表存在
我的MainActivity代码如下:
SQLiteDatabase DB = Context.openOrCreateDatabase(
"WaterElectricityReadingDataBase.db",
MODE_WORLD_READABLE, null);
final String CREATE_TABLE = "create table if not exists "
+ TABLE_NAME + "(" + COLUMN_NAME_READING_ID
+ " integer primary key autoincrement,"
+ COLUMN_NAME_READING_MODE + " text not null,"
+ COLUMN_NAME_PASTDATETIME + " date not null, "
+ "EndDateTime date not null, "
+ COLUMN_NAME_READINGVALUE + " integer not null" + ");";
DB.execSQL(CREATE_TABLE);
是表或数据不执着?我错过了设置中的任何内容吗?
请纠正我,谢谢。
发布logcat输出 – 2013-03-13 04:26:59
请参考这个http://stackoverflow.com/questions/10568861/sqliteexception-no-such-table-exists – Anu 2013-03-13 04:27:15
你可以尝试在手机上运行? – 2013-03-13 04:27:34