Link to home
Start Free TrialLog in
Avatar of benjvr
benjvr

asked on

locate method on ADODataset

Hi,

I have a filtered ADODataset and Im calling the locate method on it. I am finding that the method is not working consistently - sometimes it returns TRUE even when I know a record does not exist. I also get the BOF or EOF error when calling locate on an empty dataset. I have applied the ADO update patch for Delphi 5 and still get the quirky behaviour.

Any feedback or tips regarding using locate on a filtered adodataset will be welcomed.

Avatar of Stuart_Johnson
Stuart_Johnson

Hi benjvr,

This seems to be a problem that has occured with ADO since day one.  I've never got it to work consistently.  I just use the standard TTable instead.  That works fine.

Stu
Avatar of Mohammed Nasman
Hello
 
  locate working fine with me, which database you are using?

  and try to filter ur data using SQL (from commandtext property) instead of filter property, and try that again

Best regards
Mohammed Nasman
I mean by using SQL using where clause in the commandtext property)

 ADODataSet1.CommandText := 'select * from customers where city = "anycity"';
  ADODataSet1.Open;
Yeah ADO locate doesn't work consistently for me either using MS Access, mainly on text fields.


The Crazy One
Hi Mohammed,

It does work, but not all the time.  Sometimes the result will return false even when we know that the locate should work.  It's not reliable enough to be get a constant result.

I've only tried it from MS Access 97, 2000 and SQL Server 7.0.  It may work fine with other DBs.

Cheers!

Stu.

PS.  Sorry benjvr - I guess it sounds like I'm hogging the question, but it's not intentional.  I'm just adding my thoughts in as we both seem to be having the same problem.
ASKER CERTIFIED SOLUTION
Avatar of Stuart_Johnson
Stuart_Johnson

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It is a bug in the Locate method.

Here you can find a good and free component which corrects this bug and others:
http://web.orbitel.bg/vassil/
Seeing as though this question has been posted in again, I might ask the benjvr if he has solved the problem, or if any of our suggestions have worked.  I'm still standing by my orginal post.

Stu.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

accept Stuart Johnson's comment as answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Thanks,

geobul
EE Cleanup Volunteer