1. Course
  2. SQLite Databases
  3. CRUD operations

CRUD operations


Last updated: 8/23/2020 Difficulty: Intermediate

Create a C# program that allows you to perform CRUD operations from SQLite, the program must have the following menu:

  • 1. Add
  • 2. Show
  • 3. Edit
  • 4. Delete
  • 5. Exit

First prepare a SQLite version 3 database of people with a person table using the input's SQL query. Then create the CRUD operations (add, view, edit, and delete).

Add

Ask the user for a name and age and insert the data into the database.

Show

Show all the people saved in the database.

Edit

Request the person's code from the user and, if it exists, request the new name and age to modify the data in the database.

Delete

Request the person's code from the user and if it exists, delete the person from the database.

Exit

End the program.

You don't have to worry about the person's code as it is auto-incremental.

Input

create table if not exists person
(
   cod integer primary key autoincrement,
   name varchar(20),
   age int
)

Output



                    

Solution

SQLite Databases

4 / 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.

Make a donation


Your donations support our work and contribute to the maintenance of the app.

Advertising