PDA

Click to See Complete Forum and Search --> : ADO.net - console app. to download pic (blog.file) from the Sql server database


Subi
Jun 2nd, 2007, 01:01 PM
I looking for easier way to download some picture (type Image) from my central sqlserver database to my loca drive....I have a table with ImangeId, Description and the image itself...can I also use the same datareader for fetching the images ..or any other best options..

jmcilhinney
Jun 2nd, 2007, 08:58 PM
Images are retrieved from and stored to databases using byte arrays. This code (http://www.vbforums.com/showthread.php?t=469562) is in VB.NET but can easily be converted to C#, either manually or using an online converter.

Note that that code operates on a single field in a single record. If you use a DataReader or DataAdapter to get multiple records then each image field will contain a byte array and you use the same principle as demonstrated with each field value you want to convert to or from an Image object.