How to reference SQLite database that already exists in Xamarin.Android?

我们两清 提交于 2021-01-28 16:45:57

问题


I have created SQLite database and have copied it in the root of the project like that:

The database is called MobileSell.db It appears in Visual Studio like that:

My question is how can I reference it so afterwards I can say connection.InsertIntoTableArticles(value)(this is pseudo code)


回答1:


You can refer to this.

There only three steps to achieve it:

1) Create Assets folder which is parallel with Resources folder in your project, put your .db file into it.

2) Copy the .db file to SDCard when first open the app;

3) Use SQLite.SQLiteConnection(path) to open your .db and query it.



来源:https://stackoverflow.com/questions/48226088/how-to-reference-sqlite-database-that-already-exists-in-xamarin-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!