Een late reactie: maar ik liep ook tegen het probleem op
dus ik nog wat verder zoeken en ja hoor het is foutje in de DbAdapt.Pas unit:
Code:
TCustomDataSetAdapter.LocateKeyParams function:
if {we should modity here}FieldList.Count <> 0 then
begin
...
Result := DataSet.Locate(KeyFields, KeyValues, []);
end
else
Result := True; // No locate params
thus, this method use Dataset's Locate method, but have not consider whether the dataset is empty. yes Locate method often return false when it search a empty dataset.
In the method which call this function, Like TCustomDataSetAdapter.SilentLocate and TCustomDataSetAdapter.Locate function, we can see the exception would be throw:
{In SilentLocate method}
Result := LocateKeyParams(TLocateParamsWrapper.Create(L));
......
{In Locate method}
if not SilentLocate(LocateParamsList, True) then
RaiseRowNotFound
...
fix it would be easy, just add a condition like this(if you have a better way, then tell me please)
{In TCustomDataSetAdapter.LocateKeyParams method}
if (Dataset.RecordCount <>0) and (FieldList.Count <> 0) then
begin
...
Result := DataSet.Locate(KeyFields, KeyValues, []);
end
else
Result := True;
Bookmarks