private void Cmdxoahoa_Clicked(object sender, EventArgs e) { database db = new database(); Hoa l = new Hoa { Maloai = txtmaloai.AutomationId, Mahoa = txttenhoa.Text, Tenhoa = txttenhoa.Text, Hinh = txthinh.Text, Gia = txtgiaban.Text, Mota = txtmota.Text }; if (db.DELETE(l) == true) { DisplayAlert("Thông Báo", "Xóa hoa thành công", "OK"); } else { DisplayAlert("Thông Báo", "Xóa hoa Lỗi", "OK"); } }
public bool DELETE(Hoa h) { try { using (var connection = new SQLiteConnection(System.IO.Path.Combine(folder, "qlhoa.db"))) { connection.Delete(h); return(true); } } catch (SQLiteException ex) { // Log.Info("SQLiteEx", ex.Message); return(false); } }