Read list from databases
Create a C# program that fetches a list of people from an SQLite database. Prepare a Person class with two properties (Name and Age) the first will be of type text and the second of integer type.
To connect to SQLite open a new connection against the database file, then create a new command using the
SQLiteCommand object and finally use the
SQLiteDataReader reader to get all the results in a people list from the following SQL query.
select name, age from person
Remember that to connect to SQLite you will need the reference of
System.Data.SQLite , you can get it from official page or install it directly in your project using the Nuguet package manager, executing the following command in the console:
Install-Package System.Data.SQLite -Version 1.0.112