Видалення даних з таблиці
Приклад
using Microsoft.Data.Sqlite;
public class Page
{
public bool IsNew { get; set; }
public long ID { get; set; } = 0;
public string GroupName { get; set; } = "";
public string Name { get; set; } = "";
public string Value { get; set; } = "";
public static SqliteConnection? Conn { get; set; } = null;
}
public static void DeletePage(Page page)
{
string query = @"DELETE FROM pages WHERE id = @id";
using (SqliteCommand command = new SqliteCommand(query, Page.Conn))
{
command.Parameters.AddWithValue("id", page.ID);
command.ExecuteNonQuery();
}
}
accounting.org.ua © 2023 рік