マルチスレッドアプリケーションがあります。
procedure TGridUpdater.Execute;
begin
inherited;
CodeSite.Send('Thread executed');
sp := ConnectionFactory.GetConnection.LoadStoredProc('rab_itemData');
sp.CreateParam('Tahun', ftInteger, sppdInput).Value := _form.tahun;
sp.Open;
Synchronize(DoProgress1);
sp.DataSet.First;
I := 0;
CodeSite.Send('Terminated value is ' + BoolToStr(Terminated)); //The terminated property is 'True' here. Why?
while (not Terminated) and (not sp.DataSet.Eof) do
begin
CodeSite.Send('Entering loop');
Synchronize(DoProgress);
I := I + 1;
sp.DataSet.Next;
end;
Synchronize(DoProgress2);
end;
スレッドを実行する方法
procedure TFRABData.RefreshDataset;
var
GridUpdater: TGridUpdater;
begin
GridUpdater := TGridUpdater.Create(True);
GridUpdater.OwnerForm := Self;
GridUpdater.Start;
CodeSite.Send('RefreshDataset executed');
GridUpdater.Free;
end;