byte[] buf = { 1, 3 };
System.IO.MemoryStream ms = new System.IO.MemoryStream();
this.pictureBox1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
buf = ms.GetBuffer();
var at = from p in db.ImageDetails
where p.ProductID == int.Parse(productIDtextBox.Text)
select p.ImageID;
//讀取出要修改圖片的id
var im = from p in db.ImageDetails
where p.ImageID == at.ToList()[0]
select p;
foreach (var qq in im)
{
qq.ProductID = int.Parse(productIDtextBox.Text);
qq.Image = buf;
}
//dc.ImageDetails.InsertOnSubmit(im);
db.SubmitChanges();
MessageBox.Show("完成");
0 留言