unit ProsmCh6;

interface

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

type
  TForm6 = class(TForm)
    Panel1: TPanel;
    Button1: TButton;
    RadioGroup1: TRadioGroup;
    DBText1: TDBText;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    DBText2: TDBText;
    DBText3: TDBText;
    DBText4: TDBText;
    DBText5: TDBText;
    DBText6: TDBText;
    DBText7: TDBText;
    DBText8: TDBText;
    DBGrid1: TDBGrid;
    Edit1: TEdit;
    Label9: TLabel;
    DataSource1: TDataSource;
    ADOQuery1: TADOQuery;
    DBText9: TDBText;
    procedure RadioGroup1Click(Sender: TObject);
    procedure Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
    procedure FormActivate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form6: TForm6;

implementation

{$R *.dfm}



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

procedure TForm6.FormActivate(Sender: TObject);
begin
radiogroup1.ItemIndex:=0;
ADOQuery1.Open;
end;

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

procedure TForm6.RadioGroup1Click(Sender: TObject);
begin
edit1.SetFocus;
end;

end.
