且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Xamarin的Andr​​oid C#的SQLite

更新时间:2023-12-01 13:42:22

您必须复制数据库文件从资产文件夹复制到设备上的某个地方,然后用在您的应用程序。请注意,您只需要操作一次,当你的应用程序首先启动。


I'm new to Android.

I am using Xamarin on Visual Studio and coding in C#.

I've seen samples of creating a database if it does not exist, but not what I'm looking for.

Does anyone have any code (C#) for using existing sqlite database already in Assets folder, instead of creating new database on Android device?

You have to copy the database file from your Assets folder to somewhere on the device, and then use that in your application. Note that you only have to do this once, when your application first starts up.