Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Something about datasearching
Message
From
16/03/1999 12:33:50
 
 
To
16/03/1999 12:24:01
Jacky Yuen
Myth Group Computer Technology
Hong Kong, Hong Kong
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00198173
Message ID:
00198188
Views:
17
>I'm facing to a big problem which concern about searching
>
>I wanna search a database which contains about 30000 record.
>
>Now I use for-loop to do that :
>
>idate = "11/11/1997"
>for i = 1 to reccount()
>if ew_day = idate
>thisform.list1.additem eno
>endif
>endfor
>
>I know that ,it's a stupid method .Slow ,and waste system resource too.
>
>Do you have any solution or idea about that ?

If there's an index on ew_day, the following should be much quicker:

SCAN FOR ew_day == idate
thisform.list1.additem eno
ENDSCAN

BTW, I'd recommend using a date field rather than a character field to represent dates; the sort ordering is easier, data validation is automatic, and date format issues are less of a hassle with date fields rather than strings. You can always convert to a character expression for output using the internal VFP functions, and you can do date arithmetic on a date (tommorrow is DATE()+1, one week before today is DATE()-7, two months from now is GOMONTH(DATE(),2), etc.)

>
>Thanx a lot
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform