found on CP:
C# Save and Load Image from Database[
^]
other example code:
SqlCommand cmd = new SqlCommand("select StudImagefrom tablename where id = 1");
SqlDataReader dataReader = cmd.ExecuteReader();
byte[] imageBytes = (byte[]) imageReader.GetValue(0);
MemoryStream ms = new MemoryStream(imageBytes);
FileStream fs = File.OpenWrite(imagePath);fs.Write(ms.GetBuffer(), 0, ms.Position());