Sqlite3 给出“没有这样的表"iPhone 上的错误 [英] Sqlite3 gives "no such table" error on iPhone

查看:35
本文介绍了Sqlite3 给出“没有这样的表"iPhone 上的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个 sqlite3 数据库,创建了表并插入了一些数据.我可以通过使用终端应用程序使用选择查询进行检索.

I created a sqlite3 database, created tables and insert some data. I can retrieve using select query by using terminal application.

但是当我将此数据库添加到我的 iPhone 应用程序资源并尝试以编程方式访问数据时,我收到错误消息 没有这样的表:表名"

But when i add this database to my iPhone application resources and try to access data programatically I get error as "no such table: table name"

为什么会发生这种情况?

Why does this happen?

推荐答案

sqlite3_open() 如果数据库路径不存在,则会为您创建一个空数据库.因此,您提供的路径可能不会将您引导至预期文件.使用空数据库,你会得到很多没有这样的表".

sqlite3_open() creates an empty database for you if the database path does not exist. So, it is possible that the path you gave it does not lead you to the intended file. With an empty database, you get "no such table" a lot.

这篇关于Sqlite3 给出“没有这样的表"iPhone 上的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆