| Subject |
Re: SQL statement not working on the form |
| From |
Akshat Kapoor <akshat.kapoor@kapoorsons.in> |
| Date |
Sun, 30 Aug 2020 09:16:12 +0530 |
| Newsgroups |
dbase.getting-started |
Good Morning Agostinho
> this.PRODUCTS1 = new QUERY(this) > with (this.PRODUCTS1)> left = 14.0> top = 12.0>
sql = 'select * from
"C:\Users\HOME_PC\Desktop\dBASEtutorial\PRODUCTS.DBF"'> active =
true> endwith
The above query does not have a parameter which is being modified. So
the query remains intact.
> function ENTRYFIELD1_onLostFocus()
> local ag
> ag=form.entryfield1.value
> SELECT * FROM products WHERE merk LIKE '%&ag%'
> return
You have just executed a query here you have not displayed the results.
This code will simply create a instance of query in memory but it is not
linked to any grid so will not be displayed.
Try changing the sql in products query
this.PRODUCTS1 = new QUERY(this)
with (this.PRODUCTS1)
left = 14.0
top = 12.0
sql = 'select * from
"C:\Users\HOME_PC\Desktop\dBASEtutorial\PRODUCTS.DBF" where merk like
:p_merk'
active = true
endwith
Change it using inspector so that appropriate lines for initialising
p_merk are inserted by the designer.
Set the initial value to %
then in the onLostFocus event
form.products1.param["p_merk"] = "%" +
ltrim(rtrim(form.entryfield1.value)) + "%"
form.products1.requery()
This will refresh your query and update the grid.
I did not have your table hence was unable to check the modifications
they may contain errors.
Hopefully this should solve the problem.
Regards
Akshat
|