unit Unit1;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs, FireDAC.Stan.Intf, FireDAC.Stan.Option,
FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def,
FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, FireDAC.VCLUI.Wait,
FireDAC.Stan.Param, FireDAC.DatS, FireDAC.DApt.Intf, FireDAC.DApt, Data.DB,
FireDAC.Comp.DataSet, FireDAC.Comp.Client,
Vcl.StdCtrls,
Vcl.Grids,
Vcl.DBGrids, FireDAC.Phys.ADS, FireDAC.Phys.ADSDef;
type
TForm1 =
class(TForm)
Button1: TButton;
FDConnection1: TFDConnection;
FDQuery1: TFDQuery;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
procedure Button1Click(Sender: TObject);
private
procedure FDQuery1AfterOpen(DataSet: TDataSet);
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FDQuery1AfterOpen(DataSet: TDataSet);
begin
DataSource1.DataSet := FDQuery1;
FDQuery1.ResourceOptions.CmdExecMode := amBlocking;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if (FDQuery1.Command.State <> csInactive)
then
begin
FDQuery1.Connection.AbortJob(true);
FDQuery1.Connection.Close;
end;
DataSource1.DataSet :=
nil;
if FDQuery1.Active
then
FDQuery1.Close;
FDQuery1.SQL.Text := '
SELECT * FROM Kunden ORDER BY Nachname1, Vorname1, Gebdatum1';
FDQuery1.AfterOpen := FDQuery1AfterOpen;
FDQuery1.ResourceOptions.CmdExecMode := amAsync;
FDQuery1.Open;
end;
end.