Accessing SQLite databases and Windows Visual Studio VB.Net or C# programming
by Mountain Computers Inc., Publication Date: Monday, October 5, 2020
View Count: 1445, Keywords: SQLite, VS 2019, Windows, English Dictionary, Hashtags: #SQLite #VS2019 #Windows #EnglishDictionary
[Code is below] -- I had the hardest time finding in the programming documentation and references something that I could use to access a SQLite v3 database (english dictionary from github) from Microsoft Visual Studio VB.Net, C#, C++ (any language I am happy to leverage).
This project I am working on is going to just access a local SQLite database v3 that holds an open source English dictionary from Github, and read from it using some form of programming language that is both high nor low.
Well, I figured it out over the weekend. After all the partial examples that did not have fully functional examples, here is my example. It works. I'll explain probably in a video. This will help beginners and intermediate programmers trying to get access to a local SQLite database.
Ps. It took me 7 hours to figure it out from start to finish. All the references I looked at and tried failed miserably. There was not a complete beginning to end solution.
[Update 10/09/2020] I got sidetracked with work
here is the video:
'Nuget Dependency library is System.Data.SQLite.Core and along comes Entity.Framework, System.Data.SQLite, System.Data.SQLite.EF6, and System.Data.SQLite.Linq
Public Class Form1
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Private Function MyDictionaryExists()
MyDictionaryExists = False
If My.Computer.FileSystem.FileExists("en-dictionary.db") Then
MyStatusLine.Text = "Dictionary db file exists."
Debug.Print("Dictionary db file exists.")
ListBox1.Items.Add("Dictionary db file exists.")
MyDictionaryExists = True
MyStatusLine.Text = "Dictionary db file does not exist."
Debug.Print("Dictionary db file does not exist.")
ListBox1.Items.Add("Dictionary db file does not exist.")
Private Sub mySQLiteReadDB()
If MyDictionaryExists() Then
Dim myconnectionString = "Data Source=" & Application.StartupPath & "\en-dictionary.db" & ";Version=3; FailIfMissing=True;"
Dim myConnection As SQLiteConnection = New SQLiteConnection()
Dim myCommand As New SQLite.SQLiteCommand()
Dim myData As SQLite.SQLiteDataReader
myConnection.ConnectionString = myconnectionString
' execute queries, etc
myCommand = myConnection.CreateCommand
myCommand.CommandText = "SELECT * FROM englishdictionary LIMIT 15"
myData = myCommand.ExecuteReader()
If myData.HasRows Then
ListBox1.Items.Add("Has rows. Reading 15 records.")
mycount = 1
Do While (myData.Read())
ListBox1.Items.Add(mycount & ") " & myData(0) & "," & myData(1) & ", " & myData(2))
Debug.Print(mycount & ") " & myData(0) & ", " & myData(1) & ", " & myData(2))
mycount = mycount + 1
'nothing here to do
'nothing here to do
more to come...
if you found this article helpful, consider contributing $10, 20 an Andrew Jackson or so..to the author. more authors coming soon
FYI we use paypal or patreon, patreon has 3x the transaction fees, so we don't, not yet.
© 2023 myBlog™ v1.1 All rights reserved. We count views as reads, so let's not over think it.