How to store jpeg / gif / bmp image in database and how to
retrieve them? The most stressful condition is database is
distributed and stored images can be retrive from any
computer in network and any one can store images from other
computer!! plss help its urgent.......RAHUL RATHOD

Answer Posted / raj

Hi Rahul,
if you want to save image in SQL Server DataBase,
first we have to convert that image into bytes(BCoz SQL
Server support byte format).
using system.io.iostream we can convert image into stream
of bytes.

For example :

stfFilename is path that contain your image.

Public Shared Function LoadImage(ByVal stfFilename As
String) As System.Drawing.Image

Dim oStream As System.IO.Stream
Dim oAssembly As System.Reflection.Assembly
oAssembly = System.Reflection.Assembly.GetEntryAssembly
oStream = oAssembly.GetManifestResourceStream(stfFilename)
Return System.Drawing.Image.FromStream(oStream)
End Function

for retrieving image from DB just reverse concept.

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Define manifest?

541


How a base class method is hidden?

613


Name some of the features present in vb 2005?

570


What do you mean by serialization and deserialization?

542


Explain the observations between vb.net and vc#.net?

529






Which is the tool which can convert visual basic old version to .net compatibility version?

529


How do you retrieve the customized properties of a .net application from xml .config file?

516


Explain option explicit?

558


Can you please explain the difference between authentication and authorization?

536


What is private assembly?

517


What are the different types of a stream?

561


Explain and brief about rapid application development tool?

588


Name the tool which can convert visual basic old version to .net compatibility version?

516


Sir, what code to store data from vb net sql server 2008 to 2005 and at the same time in order to validate the data entered is not the same, but there have been contacts in the module. Examples such as the log table that I created, the user name as the primary key.

1751


what is common language specification?

517