If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Update BLOB

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-12-03, 23:31
bign002 bign002 is offline
Registered User
 
Join Date: Oct 2003
Posts: 9
Question 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.
Reply With Quote
  #2 (permalink)  
Old 11-14-03, 00:26
jay1972 jay1972 is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 11-16-03, 20:05
bign002 bign002 is offline
Registered User
 
Join Date: Oct 2003
Posts: 9
Thumbs up Re: BLOB

Thank you so much for your help.

Bign002

Quote:
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On