Translate

2012/03/31

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; 

沒有留言:

張貼留言

DataSnap REST + JS framework = full stack development (CHT)

ExpressWeb Framework, IntraWeb, UniGUI, Raudus, Elevate Web Builder, Kitto, Delphi MVC Framework... Delphi 這麼多 Web Solution 中,你用過哪幾種? ...