How to save/retrieve blob data to/from an entity

Posts   
 
    
zephyrs
User
Posts: 18
Joined: 30-Oct-2004
# Posted on: 20-Jan-2005 12:20:56   

Hi

I'm trying to write some code to save and retrieve an excel spreadsheet file to an "ole object" field in MS Access (format=long binary). I wonder if there is a way to use the "getbytes" way of reading data back from an entity? Any ideas on the best way to perform this task using LLBL?

My code so far...


                     Dim fs As FileStream
                            Dim bw As BinaryWriter
                            Dim bufferSize As Integer = 300000
                            Dim outbyte(300000 - 1) As Byte
                            Dim retval As Long
                            Dim startIndex As Long = 0

                
                            fs = New FileStream(savedFileName, FileMode.OpenOrCreate, FileAccess.Write)
                            bw = New BinaryWriter(fs)
                            startIndex = 0
                            retval = _MailshotEvent.FileObject

                            ???.................GetBytes(0, 0, outbyte, 0, bufferSize)





                            bw.Write(outbyte)
                            bw.Flush()
                            ' Close the output file.
                            bw.Close()
                            fs.Close()

Many thanks for any help.

Mark

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 20-Jan-2005 13:24:14   

Blobs are read in one go, not in chunks. This is to prevent overhead code required to control the chunkreading, as the reading of the blob is transparent to the developer.

Frans Bouma | Lead developer LLBLGen Pro