Home > Archive > Programming with dBASE > March 2006 > at()









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author at()
bruno GENTILINI

2006-03-30, 1:24 pm

Bonjour, Hi

in dbaseIV I use the function AT()

example
use data
set filter to AT(<search expC>, <fields of data> ) > 0

could you send me an example with dbase plus using a rowset

Cordialement / Thanks and regards
Bruno GENTILINI


*Lysander*

2006-03-30, 8:24 pm

bruno GENTILINI schrieb:

> could you send me an example with dbase plus using a rowset


You can use rowset-filters in dBase-Plus. But I would not recommend
them, because they make your program in-flexible when later you want to
use SQL-Data.

My recommendation would be to use a WHERE-clause in the SQL-statement.

Like this:

d = new database()
d.databasename = "mydatabase"
d.active = .T.

q = new query()
q.database = d
q.sql = "select * from <tablename> where <fieldname> LIKE
'%'+<searchstring+'%'"
q.active = .T.

This will deliver a rowset with all records where "searchstring" is any
_part_ of the field "fieldname" of table "tablename".


Later, you can build a parametrized query of this.
Like this:

q = new query()
q.database = d
q.sql = "select * from <tablename> where <fieldname> LIKE :pm_search"
q.params["pm_search"] = "%"+searchstring+"%"
q.active = .T.

now, whenever your user is changing the searchstring, for example by
entering something into an entryfield, like this:

function entryfield1_onchange


form.q.params["pm_search"] = "%"+form.entryfield1.value+"%"
form.q.requery()

return



bruno

2006-03-31, 3:24 am

thanks a lot

Bruno

"*Lysander*" <nobody@nowhere.com> a écrit dans le message de news:
lxK1MDDVGHA.416@news-server...
> bruno GENTILINI schrieb:
>
>
> You can use rowset-filters in dBase-Plus. But I would not recommend them,
> because they make your program in-flexible when later you want to use
> SQL-Data.
>
> My recommendation would be to use a WHERE-clause in the SQL-statement.
>
> Like this:
>
> d = new database()
> d.databasename = "mydatabase"
> d.active = .T.
>
> q = new query()
> q.database = d
> q.sql = "select * from <tablename> where <fieldname> LIKE
> '%'+<searchstring+'%'"
> q.active = .T.
>
> This will deliver a rowset with all records where "searchstring" is any
> _part_ of the field "fieldname" of table "tablename".
>
>
> Later, you can build a parametrized query of this.
> Like this:
>
> q = new query()
> q.database = d
> q.sql = "select * from <tablename> where <fieldname> LIKE :pm_search"
> q.params["pm_search"] = "%"+searchstring+"%"
> q.active = .T.
>
> now, whenever your user is changing the searchstring, for example by
> entering something into an entryfield, like this:
>
> function entryfield1_onchange

>
> form.q.params["pm_search"] = "%"+form.entryfield1.value+"%"
> form.q.requery()
>
> return
>
>
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com