System.AppContext.BaseDirectory    指放在当前项目下

var dbPath = Path.Combine(System.AppContext.BaseDirectory, “MyDatabase.db”);

//创建数据文件
SQLiteConnection.CreateFile(dbPath);

打开数据连接
m_dbConnection = new SQLiteConnection(@”Data Source=”+ dbPath + “;Version=3;”);
m_dbConnection.Open();

www.npspro.top互联侠客
IT互联侠客 » C# SQLite连接数据库文件及路径

发表回复

最TOP的Docker,软路由,虚拟机等学习资料

立即查看 了解详情