Example #1
0
        private void BtnUpdate_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename='F:\C# FINAL ASSIGNMENT (GROUP 06)\DATABASE (Accounts).mdf';Integrated Security=True;Connect Timeout=30");

            String     update = "UPDATE Items SET Quantity = '" + CbQty.SelectedItem + "' WHERE Item_No = '" + TxtItemNo1.Text + "' ";
            SqlCommand cmd    = new SqlCommand(update, con);

            try
            {
                con.Open();
                cmd.ExecuteNonQuery();
                MessageBox.Show("Quantity Updated successfully!", "CONGRATULATIONS!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                CART c = new CART();
                c.Show();
                this.Hide();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error detected :" + ex, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                con.Close();
            }
        }
Example #2
0
        private void Button8_Click(object sender, EventArgs e)
        {
            CART c = new CART();

            c.Show();
            this.Hide();
        }