I'm playing around a bit with trying to get a sqlite database to open and display in a mobile application, and I'm having some trouble getting it going.
From what I can tell, the file isn't being copied like it's supposed to. When I go into file explorer on the simulator, there is a file, but its getting created when the program calls connection.open, and not getting copied from the project directory. It has a size of 0.
I have the file pgt.db3 set to copy always.
here's the code:
Imports System.Data.SQLite
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim conn As New SQLiteConnection("Data Source=|DataDirectory|pgt.db3;")
conn.Open()
Dim cmd As New SQLiteCommand("Select * From PGT", conn)
Dim reader As SQLiteDataReader
reader = cmd.ExecuteReader ' table not found error happens here, the code after this has not been tested in any way.
Dim lItm As New ListViewItem
Do While reader.Read
lItm.Text = reader.Item(0).ToString & " - " & reader.Item(1).ToString
ListView1.Items.Add(lItm)
reader.NextResult()
Loop
End Sub
End Class
Is there anything else that I'm missing?