android.database.sqlite.SQLiteException: No such table exists -


this question has answer here:

i have sample android app in created database, created table , inserted data table. next day, on opening eclipse ide , running app through emulator, app gets closed, sqlliteexception saying no such table.

my mainactivity code follows:

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); 

is table or data not persistent? have missed in setup?

please correct me, thanks.

change code :

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);"; 

and tell me working or not?

good luck.


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -