This expression will evaluate to a unique string for each row in the blob column. This allows OLE to reference each blob row as a unique object. This case uses a series of unique expressions created by adding the unique blobkey onto the string blob'. It is common to use the primary key field in this expression. Test your OLE column in the Design Preview mode. Double-clicking on the control will start the server application, either with a new document , if you specified the server by object class, or with a copy of the template, if you specified a template file. In order to make the OLE column more visible, it is often a good idea to place a graphic object behind it, or to give it visible border. When you have actually stored data in the column, the control will be represented on the data window by an icon appropriate to the server application you have assigned to that OLE column. In our case the control will be represented by the cassette icon appropriate to the Microsoft Sound System .WAV server, the Quick Recorder. Updating an OLE Column OLE columns should never be updated from anywhere but within the datawindow. OLE objects are stored along with a "wrapper" or object container that describes their class and provides information on the server which originated them, and this "wrapper" must be reserved when the field is updated. This functionality is built into the datawindow and the OLE column object, but if you attempt to update the Blob from somewhere else you will destroy the wrapper around the data, leaving it useless with respect to OLE. Using the dwOLEActivate Function
If you wish to activate an OLE column programmatically i.e., without requiring the user to double- click on the column you can make use of the dwOLEActivate. Also, if you wish to activate an OLE column using a 'verb' different from the default you will need to use this function. The format of this function is: datawindowcontrol.dwOLEActivate ( row, column, verb ) datawindowcontrol: The name of the DataWindow control or child DataWindow from which you want to activate on-line linking and embedding (OLE). row: A long identifying the row location of the OLE object column: The column location of the OLE object. It is best to use a string containing the column name. Using the example in figure 1, this would be "sound_blob" verb : Usually 0, but the verb is dependent on the OLE server Let assume for the moment that you have created a datawindow, called "dw_sound", which has an OLE column called "sound_blob" which is used to contain .WAV files with Microsoft's Quick Recorder as the OLE Server. Some sample commands might be: dw_sound.dwOLEActivate(5, "sound_blob", 1) This will activate OLE for the OLE Column "dw_sound" in row five. We are passing the verb 1, which means Edit for this OLE Server, so we will activate the link for edit. dw_sound.dwOLEActivate(2, 4, 0) This will activate OLE for row two, column four (which better be an OLE column!), passing the verb 0. In this case 0 represents the action "Play" so this command will play the .WAV stored in row two, column four. A Note on Verbs
: What each verb does and which number maps to that verb vary with each OLE server. See the documentation provided with your OLE server to determine this. To see a list of verbs for your server you can consult the Registration Database, using Microsoft's REGEDIT.EXE, which is provided with windows. To do so, run this command line: REGEDIT /V Which will show you the Registration Tree, from which you can see the verbs and their associated numeric values. Note: The Registration Database is essential to many Windows operations. Consequently, you should never manually edit the database, unless it is absolutely necessary. Should editing be necessary you should be very careful in the process. A Note to Sybase Users While Sybase will handle OLE columns well, there is a limitation with blobs mapping onto the text datatype. Because of the way Sybase's string functions work, you are limited to a 4K field size when working with the Text type as a blob field. The work around for this is to make the field an OLE field, as the low-level functions which deal with the SQL Server in OLE columns do not have this 4K limit. III. Accessing Informatio






