Problem with Oracle Objects for OLE appendchunk method in VB 
Author Message
 Problem with Oracle Objects for OLE appendchunk method in VB


I am programming Oracle apps in VB. I am using Oracle Objects for OLE to
create a front end app that allows the loading of large binary files into a
longraw column.

My problem is with the appendchunk method. I cannot get the sample code
supplied by Oracle to work properly. The code successfully completes its first
pass through the loop. The second pass invariably triggers an ole automation
error when the appendchunk method is invoked. I have checked the lastservererr
properties, but they return 0.

Any help greatly appreciated,

rob bageant

Sub AppendChunkExample (FName As String)

 'Declare various variables.
 Dim NumChunks As Integer, RemChunkSize As Integer
 Dim TotalSize As Long, CurChunk As String
 Dim I As Integer, FNum As Integer, ChunkSize As Integer

 'Set the size of each chunk.
 ChunkSize = 10240

 frmChunk.MousePointer = HOURGLASS

 'Begin an add operation.

 'Clear the LONGRAW field.
 OraDynaset.Fields("LONGRAW").Value = ""

 'Get a free file number.
 FNum = FreeFile

 'Open the file.
 Open FName For Binary As #FNum

 'Get the total size of the file.
 TotalSize = LOF(FNum)

 'Set number of chunks.
 NumChunks = TotalSize \ ChunkSize

 'Set number of remaining bytes.
 RemChunkSize = TotalSize Mod ChunkSize

 'Loop through the file.
 For I = 0 To NumChunks

  'Calculate the new chunk size.
  If I = NumChunks Then
   ChunkSize = RemChunkSize
  End If

  CurChunk = String$(ChunkSize, 32)

  'Read a chunk from the file.

  Get #FNum, , CurChunk

  'Append chunk to LONGRAW field.
  OraDynaset.Fields("LONGRAW").DbAppendChunk (CurChunk)
 Next I

'Complete the add operation and update the database.

 'Close the file.
 Close FNum

 frmChunk.MousePointer = DEFAULT

End Sub

Copyright 1994 Oracle Corporation

Sun, 17 May 1998 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. alias for a method of OLE object which is also a VB method

2. Using AppendChunk to store OLE objects?

3. Oracle Objects 4 OLE / VB5 / NT 4 problem

4. Oracle OLE Object Connection Problem

5. VB6 and Oracle Objects for OLE problem (TNS could not resolve)

6. Need help passing an array to an Oracle procedure using Oracle Objects for OLE

7. Problem with AppendChunk method in ADO

8. Problem with AppendChunk method in ADO

9. VB and Oracle Objects For OLE

10. Oracle Objects for OLE, Crystal Reports and VB

11. VB and Oracle Objects for Ole

12. Using VB with Oracle Objects For OLE.


Powered by phpBB® Forum Software