Try taking the boolean parameter off: you may not have color information embedded in your image in the db.
newImage = Image.FromStream(ms);
DOH! I missed that the first time round: Add a line:
using (MemoryStream ms = new MemoryStream(imageData, 0, imageData.Length))
{
ms.Write(imageData, 0, imageData.Length);
ms.Seek(0,0);
newImage = Image.FromStream(ms,true);
}
Otherwise the stream is past the data when you try to read it into the image...
Or just do this:
using (MemoryStream ms = new MemoryStream(imageData))
{
newImage = Image.FromStream(ms);
}
"K THANKS I WANT TO KNOW HOW BYTE VALUE IS PASS TO QUERY"
Try:
using (SqlCommand com = new SqlCommand("INSERT INTO myTable (picture) VALUES (@PIC)", con))
{
com.Parameters.AddWithValue("@PIC", MyData);
com.ExecuteNonQuery();
}
Obviously you need to expand that to cover all your other fields as well, but that typing I will leave to you! :laugh: