i face problem when i try create sqlite database with password.
When I create database without password it is work very good but if i try to set password it give me error message "Could not load file or assembly 'System.Data.SQLite.SEE.License, Version=1.0.117.0, Culture=neutral, PublicKeyToken=433d9874d0bb98c5' or one of its dependencies. The system cannot find the file specified.".
My Code Is :
Imports System.Data.SQLite
Imports System.IO
Public Class Form1
Dim DB_Path As String = Application.StartupPath & "\DB\database.sqlite"
Private Async Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
If File.Exists(DB_Path) = False Then
' create db folder if not exist
If Not (System.IO.Directory.Exists(Application.StartupPath & "\DB\")) Then
System.IO.Directory.CreateDirectory(Application.StartupPath & "\DB\")
End If
' Create a new SQLite connection
Using conn As New SQLiteConnection("Data Source=" & Application.StartupPath & "\DB\database.sqlite" & ";Version=3;")
'set db password
conn.SetPassword("ashraf123") ' the error here
'change db conn string
conn.ConnectionString = "Data Source=" & DB_Path & ";Password=ashraf123;Version=3;"
'open conn
Await conn.OpenAsync
' do somthing
End Using
Else
Using conn As New SQLiteConnection("Data Source=" & DB_Path & ";Password=ashraf123;Version=3;")
Await conn.OpenAsync
' do somthing
End Using
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
End Class
I tried that change platform from any cpu to x86. I tried that change platform from any cpu to x64. I tried that Copy system.data.sqlite.dll and all other .dll files to startup app folder. I tried uninstall all packages and reinstalled them again. i tried creat new project and do all mentioned steps.
CodePudding user response:
install this package SQLitePCLRaw.bundle_e_sqlcipher and use the password in connection string like this :
Data Source=" & DB_Path & ";Password=ashraf123
CodePudding user response:
SQLite Encryption Extension error
[email protected] When I create database without password it is work very good but if i try to set password it give me error message "Could not load file or assembly 'System.Data.SQLite.SEE.License, Version=1.0.117.0, Culture=neutral, PublicKeyToken=433d9874d0bb98c5' or one of its dependencies. The system cannot find the file specified.".
This error message is indicating that the System.Data.SQLite.SEE.License assembly could not be found. This assembly is required for the use of the SQLite Encryption Extension (SEE) which is used to encrypt and decrypt the database.
It seems like you are missing the SQLite Encryption Extension (SEE) library. You can download the library from the official website of System.Data.SQLite.
Another solution is to install the package via NuGet package manager by searching for "System.Data.SQLite.Core" and "System.Data.SQLite.EF6"
Also make sure that you are using the correct version of the library that is compatible with your version of SQLite and your development environment.