Page 1 of 1

ADO Sql and Requery

Posted: Sat Mar 01, 2008 2:42 pm
by Jack
With DBF files, i use a listbox in a dialog and display the records of the DBF .
If the user want to search , he press the search button and write what he is looking for

How to do the same with record set, how to requery ??


Thanks for your help .
=======================
Xbase sample:

select 0
use adresses
set index to NAME
go top
DEFINE DIALOG ...
REDEFINE LISBOX oLbx FIELDS ...
REDEFINE BUTTON .... ACTION (RESEARCH(),oLbx:upstable(),oLbx:refresh()
ACTIVATE DIALOG ...




function RESEARCH()
local av
av:=space(20)
if MsgGet (" Recherche Patient ","Search :",@av)
seek trim(av)
endif
return .T.

Posted: Sat Mar 01, 2008 4:01 pm
by Rick Lipkin
I use the sort option when I have multiple search possibliities .. consider this code :

oRs:Sort := "fname"
oRs:MoveFirst()
oRs:Find("fname = '"+cFIND+"'" )

oLBX:ReFresh()
SysReFresh()

.. or

oRs:Sort := "lname"
oRs:MoveFirst()
oRs:Find("lname = '"+cFIND+"'" )

oLBX:ReFresh()
SysReFresh()

..

Rick Lipkin

Posted: Sun Mar 02, 2008 5:56 pm
by Jack
Rick,
Thanks for this answer but what have i to to
if the date is not in the record set .
I i have a table with 1 000 000 of records or more,
i will not have : select * form table
i will place a first scope : select * form table where NAME like "J*"
and if the user want to llok for a name starting with R ...
How to refresh ?