unit UdalK9;

interface

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

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

var
  Form9: TForm9;

implementation

{$R *.dfm}

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

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

procedure TForm9.Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
sqlfilter();
end;

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

end.
