Navigation:  Support Classes >

DaoLongBinary Class

Previous pageReturn to chapter overviewNext page

Purpose

The DaoLongBinary Class is a support class that holds the LongBinary values.

 

Accesses

ProgidReturns the ProgId of the OleObject that is stored in the DaoLongBinary object
SafeArrayReturns the LongBinary values in the form of an OLE Safe Array. For internal use only
ValueReturns the DaoLongBinary objects in the form of a string

 

Methods

AsStringReturns the descriptive name of the Object that is stored in the DaoLongBinary object. This name is read from the registry, using the Progid of the Ole Server.
InitCreates a new DaoLongBinary Object. Accepts 3 kinds of arguments:
Windows SafeArray
The string representation of a DaoOleObject
Another DaoLongBinary object

 

Description

In this release there is limited support for LongBinary values. You can copy the values from one record to another, but there is no support to edit or display the values on DataWindows and./or dialogwindows.

 

See Also

Support for LongBinary values

DaoRecordSet:Collect

DaoField:Value

 

 

Example

LOCAL oDb                AS DaoDatabase

LOCAL oEng                AS DaoDbEngine

LOCAL oRs                AS DaoRecordSet

LOCAL osrv                AS Daoserver

LOCAL cPict                AS STRING

LOCAL oPict        AS DaoLongBinary

 

oEng        := DaoDbEngine{}

oDb        := oEng:OpenDatabase("C:\VO2Jet\Northwind.mdb")

oRs        := oDb:OpenRecordset("Categories",DbopenDynaset)

 

// First show how you can copy LongBinary fields using the DaoLongBinary object that is

// returned from the RecordSet:Collect access

//

// Copy picture of first record

//

oPict := oRs["Picture"]:Value

 

// Show the description of the kind of object

// (Qout calls the AsString() method of the DaoLongBinary method)

 

?        oPict

 

// Add new record

// No need (and no way !) to set category number, that's a AutoNumber field

 

oRs:Addnew()

oRs[2]:Value                := "New category"                                // Category name

oRs[3]:Value                := "New category description"                // Description

oRs["Picture"]:Value        := oLongBin                                        // Picture

oRs:Update()        

 

//

oSrv        := DaoServer{oRs}

 

// Now access the same recordset through the DaoServer class

// that treats LongBinary fields as Memo Fields

 

// First get the picture (this time in the form of a string)

// and show the part of string in hex mode

 

cPict        := oSrv:FIELDGET(#Picture)

? Left(AsHexString(cPict),80)

 

 

// Append new record and set the values

 

oSrv:append()

oSrv:FIELDPUT(2,"Another category")                // Category name

oSrv:FIELDPUT(3,"Another description")        // Description

oSrv:FIELDPUT(4, cPict)                                // Picture

oSrv:Commit()

oSrv:Close()