using System; using System.IO; using System.Data; using Mono.Data.Sqlite; public class Example { public static void Main() { string db = "URI=file:school.db"; // Адреса БД у поточній теці using (SqliteConnection connection = new SqliteConnection(db))// Оголошення зв'язку з БД { connection.Open(); // Відкриття зв'язку з БД SqliteCommand command = connection.CreateCommand(); // Створення вказівки запиту command.CommandText = "SELECT * FROM teachers ORDER BY sename;"; Console.WriteLine("\n"+command.CommandText); SqliteDataReader reader = command.ExecuteReader(); while (reader.Read()) { for (int j=0; j<4; j++) Console.Write("{0} ",reader.GetValue(j)); Console.WriteLine(); } reader.Close(); command.CommandText = "DELETE FROM teachers WHERE sename='ФЕСЕНКО';"; command.ExecuteNonQuery(); Console.WriteLine("\n"+command.CommandText); command.CommandText = "SELECT * FROM teachers ORDER BY sename;"; Console.WriteLine("\n"+command.CommandText); reader = command.ExecuteReader(); while (reader.Read()) { for (int j=0; j<4; j++) Console.Write("{0} ",reader.GetValue(j)); Console.WriteLine(); } reader.Close(); command.CommandText = "DELETE FROM teachers ORDER BY sename LIMIT 4;"; Console.WriteLine("\n"+command.CommandText); command.ExecuteNonQuery(); command.CommandText = "SELECT * FROM teachers ORDER BY sename;"; reader = command.ExecuteReader(); while (reader.Read()) { for (int j=0; j<4; j++) Console.Write("{0} ",reader.GetValue(j)); Console.WriteLine(); } reader.Close(); command.CommandText = "SELECT * FROM teachers;"; Console.WriteLine("\n"+command.CommandText); reader = command.ExecuteReader(); while (reader.Read()) { for (int j=0; j<4; j++) Console.Write("{0} ",reader.GetValue(j)); Console.WriteLine(); } reader.Close(); command.Dispose(); connection.Close(); } } }