Subject | RE: [IBO] Locate() goes to wrong record |
---|---|
Author | Jason Wharton |
Post date | 2005-12-10T07:43:13Z |
It would be much more helpful if you sent an actual sample application that
demonstrates the problem.
Jason Wharton
demonstrates the problem.
Jason Wharton
> -----Original Message-----
> From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com]On
> Behalf Of Joe Martinez
> Sent: Tuesday, November 29, 2005 5:55 PM
> To: IBObjects@yahoogroups.com
> Subject: [IBO] Locate() goes to wrong record
>
>
> I am trying to use Locate() on a TIBOTable object. The call to
> Locate() returns True, as if it succeeded, but the cursor is NOT
> positioned on the correct record. Here is my code:
>
> bool __fastcall TMainForm::LocateSomethingByGUID(TIBODataset*
> TheDataset,String keyname,String theguidkey)
> {
> bool result;
> String VerifyKey = "NOTHING";
> int retrycount = 0;
>
> TLocateOptions Opts;
> Opts.Clear();
> Variant locvalues[1];
>
> locvalues[0] = Variant(theguidkey);
> TheDataset->Refresh();
> while (VerifyKey != theguidkey && retrycount < 100)
> {
> result = TheDataset->Locate(keyname, VarArrayOf(locvalues, 0),
> Opts);
> if (result == false)
> return false;
> retrycount++;
> VerifyKey = TheDataset->FieldByName(keyname)->AsString;
> }
>
> return result;
> }