Click here to Skip to main content
15,889,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I have a web based asp.net project, currently i use 'image' type to store images. My friends told me, blob i more efficent than image type. Anyone know about the blob please help me.

Thank you
Elk Cloner
Posted

Yes BLOB is just saving data in binary format. You can have column varbinary in your table and you can save your images/files there.

Please see the sample table.

create table uploadtest
(
id int primary key,
filename varchar(500),
filecontent varbinary(max)
)


I have attached a sample working solution for demo purposes in the below thread.


http://www.c-sharpcorner.com/Forums/Thread/179342/how-to-upload-and-retrieve-files-from-database.aspx[^]


For demo purposes i have set to upload and download one file only.

Also i have used Entity framework, if you are using stored procedures, create a class with the above columns as properties and set the values or directly pass the stored proc content to filename and file content

Please dont forget to mark my answer as accepted if it works.
 
Share this answer
 
Comments
Elk Cloner 6-Aug-12 4:06am    
Thank you Santhosh Kumar
Santhosh Kumar Jayaraman 6-Aug-12 4:09am    
ya welcome
ASPnoob 15-Aug-12 10:37am    
Obviously no one reads my question
Blob is abbreviated for Binary Large OBject.

Blob data types are particularly useful for storing Image data from SQL Server. To store binary data of any kind, such as ASCII text, an executable (.exe) file, or a stream of bytes, and with indeterminate length, we use the Blob data type.
Details about BLOB: MSDN: Blob Data Type[^]

'Image' datatype is an OLD type defined in SQL server for storage. It will no longed be available from SQL server 2012. Microsoft is deprecating and is not suggesting usage of it anymore. Refer: MSDN: Deprecated Database Engine Features in SQL Server 2012[^]

Reason of Image datatype being deprecated should be enough indication on blob to be used as image storage datatype.
 
Share this answer
 
A blob is just binary data. I doubt it's any different.
 
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