Oracle Objects for OLE
Release 9.2

Part Number A95895-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback

Example: Inserting LOBs using Dynasets

Schema Description

Dim OraSession As OraSession

Dim OraDatabase As OraDatabase

Dim Part As OraDynaset

Dim PartImage as OraBLOB

Dim ImageChunk() As Byte

Dim amount_written As Long

'Create the OraSession Object.

Set OraSession = CreateObject("OracleInProcServer.XOraSession")

'Create the OraDatabase Object by opening a connection to Oracle.

Set OraDatabase = OraSession.OpenDatabase("ExampleDb",

"scott/tiger", 0&)

'Create a Dynaset containing a BLOB and a CLOB column

set part = OraDatabase.CreateDynaset ("select * from part",0)

set PartImage = part.Fields("part_image").Value

'First insert Empty LOB in the part_image column

part.AddNew

part.Fields("part").Value = 1234

part.Fields("part_image").Value = Empty

part.Update

'move to the newly added row

Part.MoveLast

'Open the file for reading PartImages

Open "part_picture.gif" For Binary As #FNum

'Re adjust the buffer size to hold entire file data

Redim ImageChunk(LOF(FNum))

'read the entire file and put it into buffer

Get #FNum, , ImageChunk

'call dynaset's Edit method to lock the row

part.Edit

amount_written = OraBlob.Write(ImageChunk)

part.Update

'close the file

Close FNum


 
Oracle
Copyright © 1994, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback