Accurate and concise! Great answer! :-)
On Aug 18, 1:51 pm, Benj Nunez <[email protected]> wrote: > To handle images, you need to use the MemoryStream class. Here is a > few code snippet for you to work on. > We will assume that we are accessing an image from a database and > saving this image as a *.jpg file in your local directory. Substitute > your code against mine: > > OleDbDataReader reader = null; > ... > string myquery = "SELECT IMAGEFIELD FROM TABLEFOO"; > > OleDbCommand cmd = new OleDbCommand(myquery, oleconn); > ... > reader = cmd.ExecuteReader(); > ... > byte[] blobField = (byte[]) reader["MYIMAGEFIELD1"]; > ... > MemoryStream msSomeImage = new MemoryStream(blob_Field); > Image imgImage = Image.FromStream(msSomeImage); > imgImage.Save(@ATargetPath + ".jpg"); > > Hope this helps. > > Benj >
