开发者

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 tw开发者_如何学Co tables. So why get the error message?


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.


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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜