user275788
user275788

Reputation: 833

problem about sqlite database, no such table:

I open a sqlite database and use rawquery to get data.

But the log.e show the information:

android.database.sqlite.SQLiteException: no such table: types:

But, I really have this table.

And i also try to use the other sql ,But also get the error message such as

android.database.sqlite.SQLiteException: no such table: malls:

I am sure there are this two tables. So why get the error message?

Upvotes: 11

Views: 32379

Answers (4)

dev.serghini
dev.serghini

Reputation: 2979

If you have multiple contents providers, you might think that your table exists while it does not. In which case the error you are getting is legitimate.

Take a look here for details and solution: http://devserghini.blogspot.com/2010/11/android-sqliteopenhelper-and-multiple.html

Upvotes: 2

3DRaven
3DRaven

Reputation: 11

SQLiteDatabase.execSQL() interpretation takes a single string sql, ending with ";". Two lines have not interpreted.

Creating tables in a few lines sql just not executed.

Upvotes: 1

zacharia
zacharia

Reputation: 1083

I think this error occurs when you change the table structure. To solve this, clean the data (Settings -> Manage application -> Clear data) before installing the new application.

Regards.

Upvotes: 2

CommonsWare
CommonsWare

Reputation: 1006869

If this is on the emulator, use DDMS File Explorer or adb pull to download a copy of the database file and confirm its contents.

And i crate a custom SQLiteOpenHelper to copy this file to path : /data/data/com.SGMalls/databases/mallMapv2.sqlite

If you are attempting to copy the file in SQLiteOpenHelper's onCreate(), you are too late. I would do it before then.

So the copy file code may be can not copy the complete file.

It is more likely you would get an error about a corrupt file in that case.

Upvotes: 11

Related Questions