unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ZConnection, StdCtrls, DB, ZAbstractRODataset, ZAbstractDataset,
  ZDataset, ExtCtrls, XPMan, DBCtrls, NxScrollControl,
  NxCustomGridControl, NxCustomGrid, NxDBGrid;

type
  TForm1 = class(TForm)
    ZConnection1: TZConnection;
    DBGridView1: TNextDBGrid;
    ZQuery1: TZQuery;
    DataSource1: TDataSource;
    Panel1: TPanel;
    Label1: TLabel;
    Memo1: TMemo;
    Button2: TButton;
    Button3: TButton;
    Panel2: TPanel;
    XPManifest1: TXPManifest;
    Panel3: TPanel;
    DBNavigator1: TDBNavigator;
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses Unit2;

{$R *.dfm}

procedure TForm1.Button2Click(Sender: TObject);
begin
  if Form2.ShowModal = mrOk then
  begin
    ZConnection1.Protocol := Form2.ComboBox1.Text;
    ZConnection1.Database := Form2.Edit1.Text;
    ZConnection1.HostName := Form2.Edit2.Text;
    ZConnection1.Port := StrToInt(Form2.Edit3.Text);
    ZConnection1.User := Form2.Edit4.Text;
    ZConnection1.Password := Form2.Edit5.Text;
    ZConnection1.Connect;
    ZQuery1.SQL.Text := Memo1.Lines.Text;
    ZQuery1.Active := True;
  end;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  ZQuery1.Close;
end;

end.
