We help IT Professionals succeed at work.

AppendChunk & GetChunk  returns 50% of sent

Bahnass
Bahnass asked
on
   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
    RSAtt.AddNew
    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)
    RSAtt.Update
   
    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 !!!!
Comment
Watch Question

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

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/office97/html/output/F1/D2/S5A265.asp

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.

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q194975

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