| Home | Previous Lesson: Getting Image From the Database To OLE Control Next Lesson: Copying the OLE Control |
Similar to populating the object in the OLE Control, we can also update the database column once user updates the object in the OLE control. The following code updates "screen" column in the examples_previews table in the database.
Blob lBlob
Integer lResult
lBlob = ole_1.ObjectData
SqlCa.AutoCommit = True
UPDATEBLOB "examples_previews"
set "examples_previews"."screen" = :lBlob
where "examples_previews"."window" = 'w_dialer';
If SqlCa.SqlCode <> 0 or SQLCA.SQLNRows = 0 Then
Rollback using Sqlca ;
MessageBox( "Error", Sqlca.uf_GetError())
Return -1
Else
Commit using Sqlca ;
End If
Similar to the SELECTBLOB, we are calling UPDATEBLOB, not a regular UPDATE database statement.
To see it in the action, run the application. Select 'Module > OLE Control Examples' menu option. Click on the Save to Database Using BLOB CommandButton.
| Home | Previous Lesson: Getting Image From the Database To OLE Control Next Lesson: Copying the OLE Control |