begin
DataSetBroker1.DataSet.DisableControls;
try
DataSetBroker1.DataSet.First;
while not DataSetBroker1.DataSet.Eof do
begin
if DataSetBroker1.DataSet.FieldByName('status').AsInteger <> 1 then
begin
Command.Accept := False;
Break;
end;
DataSetBroker1.DataSet.Next;
end;
finally
DataSetBroker1.DataSet.EnableControls;
end;
if not Command.Accept then
begin
[U] ACommand.Create(FlowBroker1.FlowControl);
SystemCore.TSystemCore.SystemInterface.EditFlowBackFlowTasks[/U] (ACommand);
ACommand.Free;
end;
end;
下划线部分代码我写的不对,能编译,但运行时报错!如下图
那你这样吧
procedure TMainForm.FlowBroker1BeforeFlowOut(Sender: TObject; Command: TFlowOutCommand);
begin
if DataSetBroker1.DataSet.FieldByName('sl').AsFloat > 1 then
begin
Command.Accept := False;
Command.FlowControl.FlowBack(nil);
end;
end;