Subject Re: [IBO] Locate() not working correctly
Author Andreas Bednarek
Hi,

> How is this possible? If the Locate() on 13975 is successful, then how
can
> it immediately after be on a different record?

I'm not sure if you got an answer already, this one will probably not help
you :-( Just want to say that I also had this problem with Locate and
FindNearest as well (IBO 4.2). The dataset was always pointing to completely
irelevant records. I solved this using SELECT statement with IBOQuery
instead of Locate/FindNearest with a Table. Interessant is, that it was not
buggy with all DB tables, just some. I never realised where the problem
could be...

Andreas



----- Original Message -----
From: "Joe Martinez" <joe@...>
To: "IB Objects" <IBObjects@yahoogroups.com>
Sent: Wednesday, January 28, 2004 9:15 AM
Subject: [IBO] Locate() not working correctly


> I have the following piece of code:
>
> TLocateOptions Opts;
> Opts.Clear();
> Variant locvalues[3];
> locvalues[0] = Variant(theClassID);
> locvalues[1] = Variant(theSectID);
> locvalues[2] = Variant(theEnrollID);
> SectEnrollsTable->Refresh();
> bool LocateResult =
> SectEnrollsTable->Locate("CLASSID;SECTIONID;ENROLLID",
> VarArrayOf(locvalues, 2), Opts);
> long NewKey = SectEnrollsTable->FieldByName("enrollid")->AsInteger;
>
> Note: SectEnrollsTable is a TIBOTable
>
> I was having problems where this code would often locate the wrong record,
> so I traced the execution of the code in the debugger (BCB4).
>
> Right before this block of code, theEnrollID has a value of 13975. So,
> that should be the key that it's looking for.
>
> The Locate() call (2nd to last line) returns True.
> After executing the last line, NewKey has a value of 3775, NOT 13975.
>
> How is this possible? If the Locate() on 13975 is successful, then how
can
> it immediately after be on a different record?
>
> Help!
>
> -Joe
>
>
>
___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or
InterBase
> without the need for BDE, ODBC or any other layer.
>
___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info
papers,
> keyword-searchable FAQ, community code contributions and more !
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/IBObjects/
>
> To unsubscribe from this group, send an email to:
> IBObjects-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>