We help IT Professionals succeed at work.

AppendChunk & GetChunk  returns 50% of sent

Bahnass asked
   Dear Experts Here is a code I wrote Using AppendChunk & GetChunk
    Thaugh I 'm new to this (Old with VB) I receive only 50 % of the file I save
    Do I miss somethiong  ( Or I Mess it ???)
VB6.0 SP5.0 ADO 2.6
    Dim RSAtt As ADODB.Recordset, FileBuffer As String
    Dim lngPos As Long, FileTitle As String, I As Integer, FileLen As Long
    FileToAtt = "c:\autoexec.bat"
    lngPos = InStrRev(FileToAtt, "\")
    FileTitle = Mid(FileToAtt, lngPos + 1)
    Set RSAtt = New ADODB.Recordset
    RSAtt.Open "SELECT * FROM Attachements ", PubVar.DB, adOpenKeyset, adLockOptimistic
    Open FileToAtt For Binary As #1
    FileBuffer = String(LOF(1), " ")
    Get #1, , FileBuffer
    Close 1
    RSAtt!FileName = FileTitle
    RSAtt.Fields("Attached").AppendChunk FileBuffer
    RSAtt!FileLen = Len(FileBuffer)
    FileToXtr = "C:\test.bat"
    Open FileToXtr For Binary As #1
    FileLen = RSAtt!FileLen
    FileBuffer = String(FileLen, " ")
    FileBuffer = RSAtt.Fields("Attached").GetChunk(FileLen)
    Put #1, , FileBuffer
    Close 1

Hope some help !!!!
Watch Question

I think this will help you, go to and view the example:


Please take care that the Chunk size is set in the example.

Hope this useful for you.
This is another example that might give you insight.


Explore More ContentExplore courses, solutions, and other research materials related to this topic.