هذا كود لحفظ صورة فى جدول فى الداتا بيز فى sqlserver
واريد أكواد ( التعديل والبحث )
الكود هو
if ((pictureBox1.Image != null))
{
System.IO.MemoryStream ms = new System.IO.MemoryStream();
pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat);
byte[] rawdata = ms.GetBuffer();
sqlCommand1.CommandText = "insert into Category (Category,Quantity,Image)values ( '" + textBox1.Text + "','" + textBox2.Text + "',@Img)";
sqlCommand1.Parameters.AddWithValue("@Img", rawdata);
sqlCommand1.ExecuteNonQuery();
sqlCommand1.Dispose();
sqlConnection1.Close();
pictureBox1.Image = null;
}
else
{
MessageBox.Show("لا توجد صورة");
}وشكرا جزيلا

