Subject |
Re: field type binary not working on my form |
From |
Daniel Georgi <daniel.georgi@hytec-hydraulik.de> |
Date |
Mon, 11 Sep 2023 11:13:18 +0200 |
Newsgroups |
dbase.getting-started |
Am 11.09.2023 um 06:18 schrieb AGOSTINHO:
> Dear group I just add a field type binary to my dbf file, I place a picture in it but when I drop the field from the field palette to the
> form it work OK when moving on the grid up and down but when doing a search
> then I get an program alert error windows:
> "Data type mismatch. Expecting: Object"
> when click on FIX
>
> it points to form.products1.requery()
>
> function ENTRYFIELD4_onKey(nChar, nPosition,bShift,bControl)
> form.rowset.first()
> form.products1.params['ag'] = '%'+this.value+'%'
> ==> form.products1.requery()
>
> I would also like to know how do I EDIT-CHANGE-DELETE image when on the form, I don't see any option how to program it from within the inspector.
> Thanks
> Agostinho
I know this bug, when having a query with a binary field datalinked to
an image object.
The first query succeeded but a requery causes an error.
My suggestion is to use a try catch block like in the sample below.
Maybe you have to drop the parameter in the query and build the complete
SQL statement like in my example. But first try if it works with the
parameter. Reassign the datalink to the image object.
function RefreshImage()
if form.autobag.rowset.count() > 0
try
?"try"
form.artikelbild.sql = "SELECT * FROM ARTBILD WHERE ID='" +
ltrim(str(form.autobag.rowset.fields["ITEMID"].value)) + "'"
form.artikelbild.active = true
form.image.sql = "SELECT * FROM IMAGES WHERE ID='" +
ltrim(str(form.artikelbild.rowset.fields["PARENT"].value)) + "'"
form.image.active = true
form.JOB.MAIN.C.itemimage.datasource = form.image.rowset.fields["image"]
catch(Exception e)
? "catch"
form.artikelbild.sql = "SELECT * FROM ARTBILD WHERE ID='" +
ltrim(str(form.autobag.rowset.fields["ITEMID"].value)) + "'"
form.artikelbild.active = true
form.image.sql = "SELECT * FROM IMAGES WHERE ID='" +
ltrim(str(form.artikelbild.rowset.fields["PARENT"].value)) + "'"
form.image.active = true
form.JOB.MAIN.C.itemimage.datasource = form.image.rowset.fields["image"]
endtry
if( form.artikelbild.rowset.endofset )
form.JOB.MAIN.C.itemimage.datasource := null
endif
endif
return
|
|