unit DataModule;

interface

uses
  SysUtils, Classes, DB, IBDatabase, Dialogs, IBCustomDataSet, IBQuery,
  IBTable, IBStoredProc;

type
  TDM = class(TDataModule)
    IBDatabase: TIBDatabase;
    IBTransaction: TIBTransaction;
    QueryOsoby: TIBQuery;
    QueryOsobyIDOSOBY: TIntegerField;
    QueryOsobyNAZWISKO: TIBStringField;
    QueryOsobyIMIE: TIBStringField;
    QueryOsobyDATAUR: TDateField;
    QueryOsobyMCOWOSC: TIBStringField;
    QueryOsobyULICAINR: TIBStringField;
    QueryOsobyKODP: TIBStringField;
    QueryOsobyMIASTO: TIBStringField;
    QueryOsobyPESEL: TIBStringField;
    dsOsoby: TDataSource;
    P_CZYTELNICY: TIBStoredProc;
    procedure DataModuleCreate(Sender: TObject);
    procedure DataModuleDestroy(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  DM: TDM;

implementation
{$R *.dfm}

Uses
   DateUtils, 
   Variants;

procedure TDM.DataModuleCreate(Sender: TObject);
begin
   if not IBDataBase.Connected then begin
      IBDatabase.Connected := True;
   end;
   QueryOsoby.Open();
end;

procedure TDM.DataModuleDestroy(Sender: TObject);
begin
   if IBDataBase.Connected then begin
      IBDatabase.Connected := False;
   end;
   QueryOsoby.Close();
end;

end.

