Oracle Objects for OLE Release 9.2 Part Number A95895-01 |
|
Dim OraSession As OraSession
Dim OraDatabase As OraDatabase
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&)
OraParameters.Add "PartImage", Empty,ORAPARAM_OUTPUT
OraParameters("PartImage").ServerType = ORATYPE_BLOB
'BeginTrans needs to be called since LOB locators become
'invalid after the ExecuteSQL call
OraSession.BeginTrans
OraDatabase.ExecuteSQL ("insert into part values (1234,"Oracle
Application”, EMPTY_BLOB(),NULL,NULL)
RETURNING part_image INTO :PartImage ")
set PartImage = OraDatabase.Parameters("PARTIMAGE").Value
'Open the file for reading PartImages
Open "part_picture.gif" For Binary As #FNum
'read the file and put it into buffer
Redim ImageChunk(LOF(FNum))
Get #FNum, , ImageChunk
amount_written = OraBlob.Write(ImageChunk)
' commit the transaction and close the file
OraSession.CommitTrans
Close FNum
|
Copyright © 1994, 2002 Oracle Corporation. All Rights Reserved. |
|