Пример #1
0
        private void Button5_Click(object sender, EventArgs e)
        {
            conn.ConnectionString = conString;
            cmd = conn.CreateCommand();

            try
            {
                string query = "Delete from Member where Member_ID = " + SelectMember.memberID;
                cmd.CommandText = query;

                conn.Open();
                //Execute the query
                cmd.ExecuteScalar();
                MessageBox.Show("Member account deleted!", "Confirm", MessageBoxButtons.OK, MessageBoxIcon.Information);
                SelectMember s = new SelectMember();
                s.Show();
                this.Hide();
            }
            catch (Exception ex)
            {
                string message = ex.Message.ToString();
                string caption = "Error!";
                MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                cmd.Dispose();
                conn.Close();
            }
        }
Пример #2
0
 private void ComboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex == 0)
     {
         AdministratorPage ap = new AdministratorPage();
         ap.Show();
         this.Hide();
     }
     else if (comboBox1.SelectedIndex == 1)
     {
         Librarian lb = new Librarian();
         lb.Show();
         this.Hide();
     }
     else
     {
         SelectMember memberForm = new SelectMember();
         memberForm.Show();
         this.Hide();
     }
 }