Board index » delphi » Problems with Lookup Fields and ADO

Problems with Lookup Fields and ADO

Hi,

I am using Delphi 5 Update Pack 1 with ADOExpress Update 2, and still I have
serious problems using lookup fields on my ADO Query.  If I run the
application from within delphi, I always get an EOleException Unknown error,
when delphi is trying to do something with the lookup field.

Apparently the application crashes in ADODB.pas in the
TCustomADODataSet.LocateRecord method.  It gives the error on the line which
does a FLookupCursor.Find.

      try
        InitRecord(Buffer);
        FieldCount := Fields.Count;
        if FieldCount = 1 then
          FLookupCursor.Find(GetFilterStr(FieldByName(KeyFields), KeyValues,
Partial), 0,
           adSearchForward, EmptyParam)
        else
        begin
          for I := 0 to FieldCount - 1 do
          begin
            FieldExpr := GetFilterStr(Fields[I], KeyValues[I], (Partial and
(I = FieldCount-1)));
            if LocateFilter <> '' then
               LocateFilter := LocateFilter + ' AND ' + FieldExpr else
               LocateFilter := FieldExpr;
          end;
          FLookupCursor.Filter := LocateFilter;
        end;
      finally
        RestoreState(dsBrowse);
      end;

Does anybody have an idea how this comes and what can be done to solve this
? I thought this should have been fixed with the updatepack, but apparently
the problem is still there.

Best regards,

--
Stefaan Lesage

PeopleWare N.V.

E-Mail : Stefaan_Les...@peopleware.be
Web    : www.peopleware.be

 

Re:Problems with Lookup Fields and ADO


Quote
>Does anybody have an idea how this comes and what can be done to solve this
>? I thought this should have been fixed with the updatepack, but apparently
>the problem is still there.

There is a Try/Except block in the code for lookups so you have the debuger set
to stop on errors an exception is generated.  Since this only happens inside the
Delphi IDE you can ignore the error.  Or if you set the lookupCache property to
true this error will not occur.

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:Problems with Lookup Fields and ADO


Quote
> There is a Try/Except block in the code for lookups so you have the
debuger set
> to stop on errors an exception is generated.  Since this only happens
inside the
> Delphi IDE you can ignore the error.  Or if you set the lookupCache
property to
> true this error will not occur.

Is there any other impact when I set the LookupCache to true ? Does this
have impact on my application performance ?

Thanks a lot in advance,

Stefaan
--
Stefaan Lesage

PeopleWare N.V.

E-Mail : Stefaan_Les...@peopleware.be
Web    : www.peopleware.be

Re:Problems with Lookup Fields and ADO


Quote
>Is there any other impact when I set the LookupCache to true ? Does this
>have impact on my application performance ?

It means the record in the lookup table get cached in memory.  Performance
should be a bit better but if you are changing values in the lookup table they
won't be reflected in the lookup field until the dataset with the lookup is
closed and reopened.
--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Other Threads