Esempio n. 1
0
        private void btThem_Click(object sender, EventArgs e)
        {
            if (txtMaSP.Text != "" && txtDongia.Text != "" && txtTenSP.Text != "")
            {
                try
                {
                    string MaSP   = txtMaSP.Text.Trim();
                    string TenSP  = txtTenSP.Text.Trim();
                    float  Dongia = float.Parse(txtDongia.Text.Trim());


                    emp.Insert(MaSP, TenSP, Dongia);
                    LoadSanPham();
                    MessageBox.Show("Da them thanh cong");
                }
                catch (SqlException ex)
                {
                    MessageBox.Show("Loi!" + ex.Message);
                }
            }
            else
            {
                MessageBox.Show("Phải nhập mã sản phẩm");
            }
        }