Pages

Tuesday, December 27, 2011

How to locate string in AdoQuery

Sometime for some reasons, we need to locate some values from adoquery result. Below is the function to do that :
if AdoQuery.Locate('NAME', 'jhon', [loPartialKey, loCaseSensitive]) then
Showmessage('Data is found')
else
Showmessage('Data not found');
If you want to locate in more than 1 field you can use ';' as code below :
AdoQuery.Locate('Name;Address',VarArrayOf(['jhon','Arizona']),[]);
The last parameter is optional. You can leave it blank of fill it with 'loPartialKey' or 'loCaseSensitive' as your need.

No comments:

Post a Comment

Don't Forget To Join Our Community
×
Widget