| Subject |
Re: SQL statement not working on the form |
| From |
Mervyn Bick <invalid@invalid.invalid> |
| Date |
Mon, 31 Aug 2020 19:43:46 +0200 |
| Newsgroups |
dbase.getting-started |
| Attachment(s) |
test_params.wfm |
On 2020-08-31 10:36, Mervyn Bick wrote:
> I'm afraid I have to go out this morning so I can't do this right away.
> I will, however, look at the later today.
The attached form is very similar to the example Akshat posted. It
hasn't been tested because I don't have your table but it should work.
Hard-coding a path in a query is not good programming practice so I've
used a database object with a User BDE Alias to make sure the query
knows where to find the table.
If you completed the tutorial you should already have a dbasetutoral
User BDE Alias defined. If it is not already defined you will need to
do this before you can run the form.
From the Properties menu select Desktop Properties and click on teh
User BDE Alias tab. Enter dbasetutorial as an alias. Use the "pencil"
button to navigate to the folder where your table is saved. Click the
"Add" button and then the "Apply" button. Close the dialogue window and
you should now be able to run the test form.
Mervyn.
|
** END HEADER -- do not remove this line
//
// Generated on 2020-08-30
//
parameter bModal
local f
f = new test_paramsForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class test_paramsForm of FORM
with (this)
height = 16.0
left = 50.8571
top = -0.9091
width = 79.5714
text = ""
endwith
this.DBASESAMPLES1 = new DATABASE(this)
with (this.DBASESAMPLES1)
left = 22.0
top = 2.0
width = 11.0
height = 1.0
databaseName = "DBASETUTORIAL"
active = true
endwith
this.PRODUCTS1 = new QUERY(this)
with (this.PRODUCTS1)
left = 9.0
top = 2.0
width = 9.0
height = 1.0
database = form.dbasesamples1
sql = "select * from PRODUCTS.DBF where lower(merk) like lower(:merk)"
params["ag"] = '%'
active = true
endwith
this.GRID1 = new GRID(this)
with (this.GRID1)
dataLink = form.customers1.rowset
height = 7.5
left = 8.0
top = 6.0
width = 59.0
endwith
this.ENTRYFIELD1 = new ENTRYFIELD(this)
with (this.ENTRYFIELD1)
onKey = class::ENTRYFIELD1_ONKEY
height = 1.0
left = 21.0
top = 14.0
width = 24.0
value = ""
endwith
this.rowset = this.customers1.rowset
function ENTRYFIELD1_onKey(nChar, nPosition,bShift,bControl)
form.customers1.params['ag'] = '%'+this.value+'%'
form.customers1.requery()
return
endclass
|