The most efficient algorithm for storing images in database

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I need to store literally thousands if images and scanned document in the Database. I would like to know what is the most efficient algorithm both in terms of speed and storage for saving images in database (using SQL server).

Currently I am using the following algorithms. Question is can I improve this?

'Get length of stream (lengt of file) in bytes
InByteCount = loFile.Length()

'Reallocate storage space for an array variable to the
'size of image file
ReDim IoImageValue(InByteCount - 1)
'Load stream into array of bytes.
'lnByteCount will get real number of bytes which
'were retrieved from stream
InByteCount = loFile.Read(IoImageValue, 0, InByteCount)

….
myDataRow("Image") = IoImageValue

Thanks in Advance

Al
 
Hi Al

\\\
Dim fs As New IO.FileStream("FilePath&Name", _
IO.FileMode.Open)
Dim br As New IO.BinaryReader(fs)
abyt = br.ReadBytes(CInt(fs.Length))
ds.Tables(0).Rows(0)(0) = abyt
///

I hope this helps?

Cor
 
Back
Top