using System.Data.SQLite; SQLiteCommand command = new SQLiteCommand("SELECT * FROM my_table", connection); SQLiteDataReader reader = command.ExecuteReader(); while (reader.Read()) { // do something with the data } reader.Dispose();
using System.Data.SQLite; SQLiteCommand command = new SQLiteCommand("UPDATE my_table SET column1 = @param1 WHERE id = @param2", connection); command.Parameters.AddWithValue("@param1", 123); command.Parameters.AddWithValue("@param2", 456); int rowsAffected = command.ExecuteNonQuery(); command.Dispose();In this example, the `SQLiteCommand` object is used to execute an SQL statement that updates a database table. The statement includes two parameters that are set using the `AddWithValue` method. After the statement is executed, the `Dispose` method is called on the command object to release any resources that were allocated during the operation. The SQLite3 package library is used to work with SQLite databases in C#. It provides classes and methods for connecting to databases, executing SQL statements, and managing transactions.