unit PoiskCh12;

interface

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

type
  TForm12 = class(TForm)
    Panel1: TPanel;
    Button1: TButton;
    RadioGroup1: TRadioGroup;
    Edit1: TEdit;
    Label1: TLabel;
    DataSource1: TDataSource;
    ADOQuery1: TADOQuery;
    DBGrid1: TDBGrid;
    procedure FormActivate(Sender: TObject);
    procedure Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form12: TForm12;

implementation

{$R *.dfm}

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

procedure TForm12.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 TForm12.FormActivate(Sender: TObject);
begin
ADOQuery1.Open;
radiogroup1.ItemIndex:=0;
end;

end.
