如何在 iPhone 的 monotouch 中创建 SQLite 数据库?
我是 iPad 开发新手。我已经使用 Xcode 4 在 Objective C 中创建了两个或三个 iPad 应用程序。现在我想使用 C# 在 MonoDevelop 工具中创建 iPad 应用程序。
我想创建一个基本的数据库项目,为此我需要一个使用 SQLite 数据库的基本教程。我在谷歌上搜索过,但没有找到任何教程。
I am new to iPad development. I have created two or three iPad applications in Objective C using Xcode 4. Now I want to create iPad applications in MonoDevelop tool using C#.
I want to create a basic database project, for that I need a basic tutorial, which uses a SQLite database. I searched on Google, but I didn't got any tutorial.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我已经尝试过 SqLiteClient 和 SqLite-net。我建议您阅读此处的教程:
sqlite-net
对于我来说,我只需将 Sqlite.cs 文件放入我的项目中,然后用它来编译。
然后,使用您选择的工具创建一个 SQLite 数据库并将其添加到您的 MonoTouch 项目中,并确保将构建标志设置为“内容”。一旦您的项目中包含 SQLite 数据库(将文件放在您喜欢的任何位置),您就可以以只读方式访问它...除非您执行类似于以下示例中的代码的操作...它将文件重新定位到用户的个人文件夹,您的应用程序(和您的用户)将对其具有写入权限。
如果您需要用户在运行时对数据库执行 CRUD 操作,则需要在代码中包含类似以下内容以将文件复制到用户的个人文件夹:
希望有帮助。
I have tried both SqLiteClient and SqLite-net. I would recommend you read the tutorial here:
sqlite-net
For me, I just drop the Sqlite.cs file into my project and compile with it.
Then, using a tool of your choice, create a SQLite database and add it to your MonoTouch project being sure to set the build flag as "content". Once you have the SQLite database in your project (put the file anywhere you like), you can access it in a read-only fashion...unless you do something similar to the code in the example below...which relocates the file to the user's personal folder for which your app (and your user) will have write privileges to.
If you need the user, at run time, to do CRUD operations against the database, you will need to include in your code something like this to copy the file to the user's personal folder:
Hope that helps.
要访问 sqlite,您有很多选择,例如
以及许多其他内容,甚至 Apple 的 CoreData 也看到了(http://viciproject.com/wiki/projects/coolstorage/home)(http://viciproject.com/wiki/projects/coolstorage/home) /www.sgmunn.com/?p=1)但我想上述任何选项都更容易。
希望这有助于您入门
To access sqlite you have plenty of options, like
and many others even Apple's CoreData see (http://www.sgmunn.com/?p=1) but i guess any of the above options is easier that that.
hope this helps to get you started