在www.example.com中打开SQLite连接时出现问题VB.net

ru9i0ody  于 2023-02-09  发布在  SQLite
关注(0)|答案(1)|浏览(149)

我正在学习SQLLite(多年使用SQL Server的应用程序经验)。我进展缓慢,我无法打开SQLite Studio中创建的数据库的连接。我尝试了许多不同的示例,但都没有成功。我首先尝试了Nuget包,然后访问SQLite网站,下载了. Net 4.5的64位二进制文件。无论我尝试什么,都会出现此错误:系统.错误图像格式异常。
有人能告诉我我做错了什么吗?或者给我一个真正有效的例子?
谢谢!!!

Imports System.Data.SQLite

Public Class Form1

    Private connectionstring As String

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        Dim exePath As String = System.IO.Path.GetDirectoryName(Application.ExecutablePath)
        Dim dbPath As String = exePath & "\NamesTest.db"

        connectionstring = "Data Source=" & dbPath

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Dim SQLiteConn As New SQLiteConnection(connectionstring)
        SQLiteConn.Open()
    End Sub

End Class
oxosxuxt

oxosxuxt1#

也许你必须指定版本:

connectionstring = "Data Source=" & dbPath & ";version=3;"

相关问题