首页 > 解决方案 > 您在连接字符串中指定了密码,但您使用的本机 SQLite 库不支持加密

问题描述

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

connection.ConnectionString = new SqliteConnectionStringBuilder(connection.ConnectionString)
        { Password = password }
        .ToString();
connection.Open();

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

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

任何帮助,将不胜感激。

标签: formsxamarinencryptionpasswordsmicrosoft.data.sqlite

解决方案


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

在解决方案下方,因为Jason在上面有评论:

dotnet remove package Microsoft.Data.Sqlite
dotnet add package Microsoft.Data.Sqlite.Core
dotnet add package SQLitePCLRaw.bundle_e_sqlcipher

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


推荐阅读