Пример #1
0
        private void save_Click(object sender, EventArgs e)
        {
            try
            {
                String        con    = ConfigurationManager.ConnectionStrings["WindowsFormsApplication1.Properties.Settings.librarayManagementConnectionString"].ConnectionString;
                SqlConnection sqlCon = new SqlConnection(con);
                sqlCon.Open();

                String query = "UPDATE book_registration    SET book_name ='" + book_name.Text + "',author_name ='" + author_name.Text + "',publisher ='" + publisher.Text + "',publish_year ='" + pub_year.Text + "',isbn_no ='" + isbn.Text + "',pages ='" + page.Text + "',edition ='" + edition.Text + "' ,price ='" + price.Text + "',book_type ='" + book_type.Text + "',rank ='" + rank.Text + "',department ='" + department.Text + "',[cover_image]=@cover   WHERE book_id='" + book_id.Text + "'";

                SqlCommand cmd = new SqlCommand(query, sqlCon);

                SqlParameter param = cmd.Parameters.AddWithValue("@cover", img);
                param.DbType = DbType.Binary;

                cmd.ExecuteNonQuery();
                MessageBox.Show("Record has been Saved");

                sqlCon.Close();

                view_book vb = (view_book)Application.OpenForms["view_book"];
                vb.loadbook();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #2
0
        private void viewAllBookToolStripMenuItem_Click(object sender, EventArgs e)
        {
            view_book viewBook = new view_book(account);

            viewBook.Show();
        }