Results 1 to 3 of 3

Thread: Update BLOB

  1. #1
    Join Date
    Oct 2003
    Posts
    9

    Question Unanswered: Update BLOB

    I have a problem with BLOB field in DB2. We have created tables that contain BLOB fields. The problem is when we created an application to update this field and get the data back from this filed. We debugged to check the result. We found out that our application could update BLOB field but it couldn’t retrieve the data that just was updated back. The application was created by Power Builder and used ODBC to connect it.


    I would like to ask you that if you have any ideas about this problem, please give me the solution to solve this problem. Or if you have an example code that creates by Visual Basic, please provide that code for us to be an example. It could give us an idea how to make it work in Power Builder. We are very appreciated for your help.

  2. #2
    Join Date
    Jul 2002
    Posts
    21

    Thumbs up BLOB

    Private Sub updatePicture(fld As ADODB.Field, diag As CommonDialog)
    Const BlkSize = 1024
    Dim sourcefile As Integer
    Dim FileLength As Long
    Dim LeftOver As Long
    Dim Numblocks As Integer
    Dim Chunk() As Byte
    Dim i As Integer

    sourcefile = FreeFile
    Open diag.FileName For Binary Access Read As sourcefile
    FileLength = LOF(sourcefile)
    LeftOver = FileLength Mod BlkSize
    Numblocks = (FileLength - LeftOver) / BlkSize
    ReDim Chunk(BlkSize)
    For i = 1 To Numblocks
    Get sourcefile, , Chunk
    fld.AppendChunk Chunk
    Next i
    ReDim Chunk(LeftOver)
    Get sourcefile, , Chunk
    fld.AppendChunk Chunk
    Close sourcefile
    End Sub

  3. #3
    Join Date
    Oct 2003
    Posts
    9

    Thumbs up Re: BLOB

    Thank you so much for your help.

    Bign002

    Originally posted by jay1972
    Private Sub updatePicture(fld As ADODB.Field, diag As CommonDialog)
    Const BlkSize = 1024
    Dim sourcefile As Integer
    Dim FileLength As Long
    Dim LeftOver As Long
    Dim Numblocks As Integer
    Dim Chunk() As Byte
    Dim i As Integer

    sourcefile = FreeFile
    Open diag.FileName For Binary Access Read As sourcefile
    FileLength = LOF(sourcefile)
    LeftOver = FileLength Mod BlkSize
    Numblocks = (FileLength - LeftOver) / BlkSize
    ReDim Chunk(BlkSize)
    For i = 1 To Numblocks
    Get sourcefile, , Chunk
    fld.AppendChunk Chunk
    Next i
    ReDim Chunk(LeftOver)
    Get sourcefile, , Chunk
    fld.AppendChunk Chunk
    Close sourcefile
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •