【发布时间】:2020-06-28 00:16:40
【问题描述】:
我有一个使用 “SQLite Cipher” 的加密数据库。当我尝试使用连接字符串连接到数据库时,会出现以下错误消息:
'SQL 逻辑错误无法使用“密码”连接字符串属性:库未构建加密支持。'
Imports System.Data.SQLite
Public Class frm_projects
Dim dtset As New SQLiteConnection("Data Source=Setting.db;Password=m;")
Private Sub frm_projects_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
If dtset.State = ConnectionState.Closed Then
dtset.Open()
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, "Warning")
End Try
End Sub
End Class
【问题讨论】:
-
是否允许我们在您创建连接的位置查看您的代码?
-
Dim dtset As New SQLiteConnection("Data Source=Setting.db;Password=m;") Try If dtset.State = ConnectionState.Closed Then dtset.Open() MsgBox("Connection Success!" , MsgBoxStyle.Information, "Informations") 'list_projects.Items.Add("ANa") End If Catch ex As Exception MsgBox("Failed to connect to SQLite Database", MsgBoxStyle.Information, "Warning") End Try
-
检查您的连接字符串。
Data Source=Setting.db是什么?这应该是数据库的路径。也许您的意思是:Dim dtset As New SQLiteConnection($"Data Source={My.Settings.db};Password=m;")其中db是您的应用程序设置中的字符串属性。
标签: .net vb.net sqlite sqlcipher