예제 #1
0
 private void UploadAnh()
 {
     if (!String.IsNullOrEmpty(txtMa.Text))
     {
         conn.ExecuteNonQuery("DELETE AnhSanPham where sanphamId = " + Int32.Parse(txtMa.Text));
         if (picAnh1.Image != null)
         {
             conn.ExecuteNonQuery("insert into AnhSanPham (sanphamId,anh) values (" + Int32.Parse(txtMa.Text) + ",'" + Ham.GetStringFromImage(picAnh1.Image) + "')");
         }
         if (picAnh2.Image != null)
         {
             conn.ExecuteNonQuery("insert into AnhSanPham (sanphamId,anh) values (" + Int32.Parse(txtMa.Text) + ",'" + Ham.GetStringFromImage(picAnh2.Image) + "')");
         }
     }
     else
     {
         MessageBox.Show("Bạn chưa chọn sản phẩm", "Thông báo");
     }
 }