1. Course
  2. SQLite Databases
  3. Read list from databases

Read list from databases

Last updated: 8/23/2020 Difficulty: Intermediate

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





SQLite Databases

1 / 4

Android App

Practice C# anywhere with the free app for Android devices.

Android App

Exercises C# by difficulty

Learn C# at your own pace, the exercises are ordered by difficulty.