problem about sqlite database, no such table:

前端 未结 4 1886
-上瘾入骨i
-上瘾入骨i 2020-11-29 11:32

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

But the log.e show the information:

android.database.sqlite.SQLiteException: no such t

相关标签:
4条回答
  • 2020-11-29 11:42

    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.

    0 讨论(0)
  • 2020-11-29 11:55

    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

    0 讨论(0)
  • 2020-11-29 12:01

    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 讨论(0)
  • 2020-11-29 12:09

    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.

    0 讨论(0)
提交回复
热议问题