Use Thread to open ADO


type
  TOpenQuery = Class(TThread)
  Public
     constructor Create(Q: TADOQuery;sSQL: String);
  protected
     tQry: TADOQuery;
     tSQL: String;
     procedure Execute; override;
  end;

{ TOpenQuery }

constructor TOpenQuery.Create(Q: TADOQuery; sSQL: String);
begin
  inherited Create(False);

  FreeOnTerminate:=True;
  tQry:=Q;
  tSQL:=sSQL;
end;

procedure TOpenQuery.Execute;
begin
  inherited;

  Screen.Cursor:=crAppStart;
  with tQry do Begin
     SQL.Text:=tSQL;
     Open;
  End;

  Screen.Cursor:=crDefault;
end; 

留言

這個網誌中的熱門文章

對於 Delphi 10.1 Berlin 推出的看法

IntraWeb 學習日記:【Login】