[英]How to access xamarin Android environment.personal system folder?
I am just working with sqlite DB. 我只是在使用sqlite DB。 My DB location is system.environmet.specialfolder.personal So how can access this folder 我的数据库位置是system.environmet.specialfolder.personal那么如何访问此文件夹
Here's how you can create a connection to an SQLite DB located in System.Environment.SpecialFolder.Personal
: 这是创建与System.Environment.SpecialFolder.Personal
的SQLite数据库的连接的方法:
public class SQLite_Android : ISQLite
{
public SQLiteConnection GetConnection()
{
string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
var path = Path.Combine(documentsPath, "mySQLite.db"); // change mySQLite.db for your SQLite db filename
// Create the connection
var conn = new SQLiteConnection(path);
// Return the database connection
return conn;
}
}
With 同
public interface ISQLite
{
SQLiteConnection GetConnection();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.