procedure SetDataActive(ds: TCustomADODataSet);
var
i: Integer;
begin
with ds do
begin
DisableControls;
try
Close;
Connection := DataModule.cnnErp;
for i := 0 to Fields.Count - 1 do
if Assigned(Fields[i].LookupDataSet) then SetDataActive(TCustomADODataSet(Fields[i].LookupDataSet));
Open;
finally
EnableControls;
end;
end;
end;procedure RefreshDataSet(ds: TCustomADODataSet);
var
intRec: Integer;
begin
if ds.ClassType = TADOTable then
begin
intRec := ds.RecNo;
TADOTable(ds).Requery;
if ds.RecordCount > 0 then ds.RecNo := Min(intRec, ds.RecordCount);
end else
begin
with ds do
begin
if not Active then exit;
intRec := RecNo;
DisableControls;
try
Close;
Open;
if RecordCount > 0 then RecNo := Min(intRec, RecordCount);
finally
EnableControls;
end;
end;
end;
end;
var
i: Integer;
begin
with ds do
begin
DisableControls;
try
Close;
Connection := DataModule.cnnErp;
for i := 0 to Fields.Count - 1 do
if Assigned(Fields[i].LookupDataSet) then SetDataActive(TCustomADODataSet(Fields[i].LookupDataSet));
Open;
finally
EnableControls;
end;
end;
end;procedure RefreshDataSet(ds: TCustomADODataSet);
var
intRec: Integer;
begin
if ds.ClassType = TADOTable then
begin
intRec := ds.RecNo;
TADOTable(ds).Requery;
if ds.RecordCount > 0 then ds.RecNo := Min(intRec, ds.RecordCount);
end else
begin
with ds do
begin
if not Active then exit;
intRec := RecNo;
DisableControls;
try
Close;
Open;
if RecordCount > 0 then RecNo := Min(intRec, RecordCount);
finally
EnableControls;
end;
end;
end;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货