您在连接字符串中指定了密码,但您使用的本机 SQLite 库不支持加密

Ach*_*yan 4 forms encryption passwords xamarin microsoft.data.sqlite

我在 Xamarin Forms Android 应用程序中的 Sqlite 连接字符串中设置密码属性时遇到问题。它在 Xamarin Forms iOS 中运行良好。我用过以下`

connection.ConnectionString = new SqliteConnectionStringBuilder(connection.ConnectionString)
        { Password = password }
        .ToString();
connection.Open();
Run Code Online (Sandbox Code Playgroud)

` 在此处输入图像描述 您在连接字符串中指定了密码,但您使用的本机 SQLite 库不支持加密。

我在 Xamarin Forms 应用程序上使用 Microsoft.Data.Sqlite 3.1.5 nuget 包。

任何帮助,将不胜感激。

Jha*_*kiz 7

我知道稍后再回答这个问题,但答案可以帮助其他人快速找到解决方案。

下面是杰森在上面评论的解决方案:

dotnet remove package Microsoft.Data.Sqlite
dotnet add package Microsoft.Data.Sqlite.Core
dotnet add package SQLitePCLRaw.bundle_e_sqlcipher
Run Code Online (Sandbox Code Playgroud)

https://learn.microsoft.com/en-us/dotnet/standard/data/sqlite/encryption?tabs=netcore-cli