unit RedaktCh8;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, Grids, DBGrids, ADODB, StdCtrls, ExtCtrls,UDM;

type
  TForm8 = class(TForm)
    Panel1: TPanel;
    Button1: TButton;
    Button3: TButton;
    DBGrid1: TDBGrid;
    DataSource2: TDataSource;
    ADOQuery1: TADOQuery;
    Edit1: TEdit;
    Label1: TLabel;
    procedure Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
    procedure FormActivate(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
    procedure Button1Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure sqlfilter();
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form8: TForm8;

implementation

{$R *.dfm}

procedure TForm8.Button3Click(Sender: TObject);
begin
close();
end;

procedure TForm8.Button1Click(Sender: TObject);
begin
close();
end;

procedure TForm8.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
sqlfilter();
end;

procedure Tform8.sqlfilter();
begin
    ADOQuery1.SQL.Text:='select * from formuliar_chitatelia2 where 1=1 and upper(familia) Like '+''''+AnsiUpperCase(trim(Edit1.Text))+'%''';
    ADOQuery1.Open;
end;

procedure TForm8.FormCreate(Sender: TObject);
begin
Button3.Visible:=false
end;

procedure TForm8.FormActivate(Sender: TObject);
begin
ADOQuery1.Open;
end;

procedure TForm8.Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
ADOQuery1.SQL.Text:='select * from formuliar_chitatelia2 where 1=1 and upper(familia) Like '+''''+AnsiUpperCase(trim(Edit1.Text))+'%''';
    ADOQuery1.Open;
end;

end.
