private void NAddStaffBtn_Click(object sender, EventArgs e)
        {
            LibrarySearchBook lsbook = new LibrarySearchBook();

            this.Hide();
            lsbook.ShowDialog();
        }
Exemple #2
0
        private void Button2_Click(object sender, EventArgs e)
        {
            i = Convert.ToInt32(dataGridView1.SelectedCells[0].Value.ToString());

            try

            {
                con.Open();
                SqlCommand cmd = con.CreateCommand();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "update books_info set books_name='" + textBox2.Text + "',books_isbn='" + textBox3.Text + "',books_author='" + textBox4.Text + "',books_edition='" + textBox5.Text + "',books_publisher='" + textBox6.Text + "',books_quantity='" + textBox7.Text + "'where id =" + i + "";
                cmd.ExecuteNonQuery();
                con.Close();
                display_books();
                MessageBox.Show("Record updated Successfully");
                panel4.Visible = false;

                LibrarySearchBook lib = new LibrarySearchBook();
                this.Hide();
                lib.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void Button2_Click(object sender, EventArgs e)
        {
            LibrarySearchBook libraryAddBook = new LibrarySearchBook();

            this.Hide();
            libraryAddBook.ShowDialog();
        }
Exemple #4
0
        private void Button3_Click(object sender, EventArgs e)
        {
            i = Convert.ToInt32(dataGridView1.SelectedCells[0].Value.ToString());
            con.Open();
            SqlCommand cmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "delete from books_info where Id=" + i + "";
            cmd.ExecuteNonQuery();
            con.Close();
            MessageBox.Show("Record Deleted Successfully");
            LibrarySearchBook lib = new LibrarySearchBook();

            this.Hide();
            lib.ShowDialog();
        }