3

What's the best way to store an image in a database in binary format, and how can I implement it using C#?

2 Answers 2

3

If you are using SQL Server, you can use the Image column type.

Sign up to request clarification or add additional context in comments.

5 Comments

image is deprected (msdn.microsoft.com/en-us/library/ms187993.aspx). varbinary(max) is to be prefered for new development work.
what this BLOB column actually meant
IS it meant the binary to used ... i use image column. what it differ
varbinary or binary whats the difference??
Binary is fixed length, whereas Varbinary is variable length. This article explains it quite nicely: msdn.microsoft.com/en-us/library/ms188362.aspx
2

You can find the answer to converting your image to binary here:

Convert image to binary?

You would need a BLOB column in your SQL database in order to be able to insert it.

EDIT:

If you want to retrieve it back from the database, you can use the following article to do so:

http://support.microsoft.com/kb/326502

2 Comments

why image column will not use for that?
I suggested a way to store it in binary format, as you asked. I have no experience with the Image column type, I store it in this BLOB - binary format, or as a Base64 encoded string.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.