using System.Data.SQLite; // create a SQLiteCommand object to execute SQL statements SQLiteCommand command = new SQLiteCommand("UPDATE users SET name = 'John' WHERE id = 1;", connection); // execute the SQL statement using the ExecuteNonQuery method command.ExecuteNonQuery();
using System.Data.SQLite; // create a SQLiteCommand object to execute a SELECT statement SQLiteCommand command = new SQLiteCommand("SELECT * FROM users", connection); // use a DataReader object to iterate over the results of the SELECT statement using (SQLiteDataReader reader = command.ExecuteReader()) { while (reader.Read()) { Console.WriteLine(reader.GetString(0) + " " + reader.GetString(1)); } }This example shows how to use a SQLiteStatement object to execute a SELECT statement that retrieves all users from a database. It then uses a DataReader object to iterate over the results and print them out to the console. Package Library: System.Data.SQLite.