有关SQLite数据库,没有这样的表的问题:数据库、问题、SQLite

由网友(主动久了心会累)分享简介:我打开一个SQLite数据库,并使用rawquery来获取数据。 I open a sqlite database and use rawquery to get data. 但log.e显示信息:But the log.e show the information:android.database.sqlite...

我打开一个SQLite数据库,并使用rawquery来获取数据。

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

但log.e显示信息:

But the log.e show the information:

android.database.sqlite.SQLiteException:没有这样的表:类型:

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

不过,我真的有这个表。

But, I really have this table.

我也尝试使用其他的SQL,但也得到了错误消息,如

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

android.database.sqlite.SQLiteException:没有这样的表:商场:

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

我相信有这两个表。 那么,为什么收到错误信息?

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

推荐答案

如果这是在模拟器上,使用DDMS文件资源管理器或亚行拉下载的副本数据库文件,并确认其内容。

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.

和我的箱子一个自定义SQLiteOpenHelper   这个文件复制到路径:   /data/data/com.SGMalls/databases/mallMapv2.sqlite

Android移动开发基础案例教程 第5章 SQLite数据库

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

如果您正试图复制文件的 SQLiteOpenHelper 的onCreate(),你是为时已晚。在此之前,我会做到这一点。

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

所以复制文件code可不行   复制完整的文件。

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.

阅读全文

相关推荐

最新文章