samedi 26 mars 2016

What Am I doing wrong? Cannot open SQLite database

Please I am trying to load all Tables in SQLite database into combobox I keep getting the error: An unhandled exception of type 'System.ArgumentException' occurred in System.Data.SQLite.dll

Additional information: Invalid ConnectionString format for part "C:\SQliteTest\sqlite_test\bin\Debug\test.db", no equal sign found:

The following is my code. VS keeps highlighting: SQLconnect.Open()

Dim db As String = "C:\SQliteTest\sqlite_test\bin\Debug\test.db; Version=3;"

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim SQLconnect As New SQLite.SQLiteConnection()
    Dim SQLcommand As SQLiteCommand
    SQLconnect.ConnectionString = db
    SQLconnect.Open()
    SQLcommand = SQLconnect.CreateCommand
    Dim SchemaTable = SQLconnect.GetSchema(SQLiteMetaDataCollectionNames.Tables)
    For int As Integer = 0 To SchemaTable.Rows.Count - 1
        If SchemaTable.Rows(int)!TABLE_TYPE.ToString = "table" Then
            Me.ComboBox1.Items.Add(SchemaTable.Rows(int)!TABLE_NAME.ToString())
        End If
    Next
    SQLcommand.Dispose()
    SQLconnect.Close()
End Sub

Aucun commentaire:

Enregistrer un commentaire