Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
FUNCTION ReadBinaryField
LPARAMETERS lcField,lcTable,lcWhereClause
LOCAL lcTFileName, lcFileName, lcAlias, lcResult,llField, lnResult
IF EMPTY(lcWhereClause)
lnResult = this.Execute("select " + lcField + " from " + lcTable)
ELSE
lnResult = this.Execute("select " + lcField + " from " + lcTable + " where " + lcWhereClause)
ENDIF
IF lnResult < 1
RETURN ""
ENDIF
lcTFileName = SYS(2023) + "\" + SYS(2015) + ".dbf"
lcFileName = DBF()
lcAlias = ALIAS()
*** Copy out the data - cursor deletes automatically
COPY TO (lcTFileName)
*** Close the cursor
SELECT (lcAlias)
USE
* Change the flag in the general field
llFile = fopen(lcTFilename,12)
fseek(llFile,43)
fwrite(llFile,'M')
fclose(llFile)
*** Reopen the copied file
USE (lcTFileName) ALIAS __TImage EXCL
*** Retrieve the binary field value
lcResult = EVAL("__Timage." + lcField)
*** Close and Erase the temp file
USE
ERASE (FORCEEXT(lcTfileName,"*")
IF !EMPTY(lcAlias)
SELECT (lcAlias)
ENDIF
RETURN lcResult
lcImage = ReadBinaryField("user_picture","yoursqltablename","where id=1") && adapt table name and where clause to retrieve a single record/image only.
STRTOFILE(lcImage,addbs(SYS(2023))+"test.jpg")
thisform.image1.Picture = addbs(SYS(2023))+"test.jpg"