【EF core】Microsoft.Data.Sqlite.SqliteException:“SQLite Error 14: 'unable to open database file'.”
数据库配置错误。
将相对地址修改为绝对地址就可以了。
提示错误
<?xml version="1.0" encoding="utf-8" ?> <configuration> <connectionStrings > <add name="ConnectionString" connectionString="Data Source=.\Repositories\Database.db; " providerName="Microsoft.EntityFrameworkCore.Sqlite" /> </connectionStrings> </configuration>
修改后
<?xml version="1.0" encoding="utf-8" ?> <configuration> <connectionStrings > <add name="ConnectionString" connectionString="Data Source=D:\程序开发\观察者\LYFWPFUI\LYFWPFUI\Repositories\Database.db; " providerName="Microsoft.EntityFrameworkCore.Sqlite" /> </connectionStrings> </configuration>
就不提示错误了
编程是个人爱好