VB NET和SQLITE:文件已加密或不是数据库

时间:2017-04-05 09:04:42

标签: vb.net sqlite encryption

我正在尝试使用VB.NET和SQLite创建应用程序,我已经使用SQLiteManager创建了数据库和表格,并且我已将数据库设置为加密,并且密码与连接字符串中的内容相同

但是,当我尝试将示例记录插入表时,它给出了错误file is encrypted or is not a database

这是产生错误的代码示例。

Using ConLite = OpenConLite()
        Using LiteCmd As New SQLiteCommand
            Dim TglWaktuSekarang As String = CurrentDateTime()
            LiteCmd.CommandText = "INSERT INTO finger_stamp(emp_id,emp_name,date_time) VALUES('1','DIANA','" & TglWaktuSekarang & "')"
            LiteCmd.CommandType = CommandType.Text
            LiteCmd.Connection = ConLite
            LiteCmd.ExecuteNonQuery()
        End Using
End Using

这是我的连接代码

 Public Function OpenConLite() As SQLiteConnection
    Dim SQLiteCon As SQLiteConnection
    Try
        Dim ConLiteString As String = "Data Source=C:\SQLiteDB\attendance.sqlite;Version=3;Password=hahaha;"
        SQLiteCon = New SQLiteConnection(ConLiteString) ' Connection DataSource
        SQLiteCon.Open()
        OpenConLite = SQLiteCon
    Catch ex As Exception
        OpenConLite = Nothing
        MsgBox("Failed to connect to Database", MsgBoxStyle.Information, "Warning")
    End Try
End Function

0 个答案:

没有答案