using System.Data.SQLite; using System.Threading.Tasks; public async TaskUpdateMessageAsync(string message) { using (var connection = new SQLiteConnection("Data Source=MyDatabase.db")) { await connection.OpenAsync(); using (var command = new SQLiteCommand("UPDATE Messages SET Text=@message WHERE Id=1", connection)) { command.Parameters.AddWithValue("@message", message); return await command.ExecuteNonQueryAsync(); } } }
using System.Data.SQLite; using System.Threading.Tasks; public async TaskIn this example, the method named DeleteUserAsync connects to an SQLite database and deletes a user from the Users table using the ExecuteNonQueryAsync method. The package library for this System.Data.SQLite library is System.Data.SQLite.Core.DeleteUserAsync(int id) { using (var connection = new SQLiteConnection("Data Source=MyDatabase.db")) { await connection.OpenAsync(); using (var command = new SQLiteCommand("DELETE FROM Users WHERE Id=@id", connection)) { command.Parameters.AddWithValue("@id", id); return await command.ExecuteNonQueryAsync(); } } }