| Home | Previous Lesson: Linking the OLE Control's Object To a File Next Lesson: Updating the Database BLOB Column from OLE Control |
OLE Control has an attribute "ObjectData". When an object is embedded in the control, the actual content of the object is stored in this attribute. We can assign the value of this attribute (object content) to a BLOB (Binary Large Object) variable and update the database or write to a file. The following example is using "psdemo.db" that comes along with the PowerBuilder software for example application. It reads the "screen" column from the "examples_previews" table and loads in the OLE control.
SELECTBLOB
"examples_previews"."screen" If SQLCA.SQLCode <>
0 Then ole_1.ObjectData = iImageBlob |
PowerBuilder has a datatype "BLOB" which means "Binary Large Object". If the database contains binary objects such as sound files, image files, we can't retrieve in PowerBuilder in the normal way. We need to use the BLOB type variable. We have declared a BLOB type variable "iImageBlob" as an instance variable and we are retrieving the "screen" column into this variable. Since we are using embedded SELECT statement, we have to make sure the SELECT statement returns one row only. We have only one row for the "w_dialer". The select statement is also not a regulat SELECT statement, it is SELECTBLOB statement.
To see it in the action, run the application. Select "Module/OLE 2.0 Control Examples" option from the menu. Click on the "Open Database Object" CommandButton.
| Home | Previous Lesson: Linking the OLE Control's Object To a File Next Lesson: Updating the Database BLOB Column from OLE Control |