Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a database table in SQL 2005 with a column of images (image datatype). The images are GIFs. I can write a VBScript and write out the images using ADO and I can open them just fine. When I use ADO.Net, the file doubles in size and will not open. If I insert into the table using ADO.net, I can pull it out just fine. The data is/was put in using ADO.

How can I pull the images out of the table using ADO.Net and construct them back as GIFs? Is there some translation somewhere that I am missing?
Posted

See in SQL Server 2005, image datatype is similar to Byte Arrays.

So just retrieve the data from the database as a Byte array and write to the file wheneever required. To understand the mimetype of the image, you need to store the mime type separately.

I hope this will help you.

Storing and Retrieving Images from SQL Server using Microsoft .NET[^]

:):rose:
 
Share this answer
 
I am pulling it out as a byte array and writing it to a file. Unfortunately when I do that with .Net, it is twice the size of the same image written out using ADO & VBScript. Also, the image written using ADO.Net is not at all an image. The ADO image will render correctly.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900