Public Sub ReadMyData(ByVal myConnString As String)
Dim sqConnection As New SQLiteConnection(myConnString)
Dim sqCommand As SQLiteCommand = sqConnection.CreateCommand()
sqCommand.CommandText = "SELECT DeptNo, DName, Loc FROM Dept"
sqConnection.Open()
Dim sqReader As SQLiteDataReader = sqCommand.ExecuteReader()
Try
' Always call Read before accessing data.
While sqReader.Read()
Console.WriteLine(String.Concat(sqReader.GetInt32(0).ToString(), " ", _
sqReader.GetString(1), " ", sqReader.GetString(2)))
End While
Finally
' always call Close when done reading.
sqReader.Close()
' Close the connection when done with it.
sqConnection.Close()
End Try
End Sub