コード例 #1
0
        private void btn_deleteAppointment_Click(object sender, EventArgs e)
        {
            // Get the appointment ID from the application
            appointment.AppointmentId = Convert.ToInt32(txtbx_aptID.Text);

            // Delete data from database
            bool success = appointment.Delete(appointment);

            if (success)
            {
                // Successfully deleted
                MessageBox.Show("Appointment deleted successfully.");

                // Call the method to refresh DataGrid view after deletion.
                LoadAppointmentDgvData();

                // Call the clear method
                Clear();
            }
            else
            {
                // Delete failed
                MessageBox.Show("Failed to delete appointment. Try again.");
            }
        }