readersearch.pas

来自「图书管理系统,使用Delphi开发,数据库为Microsoft SQL Serv」· PAS 代码 · 共 85 行

PAS
85
字号
unit ReaderSearch;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, BookDocuForm, ADODB, ImgList, DB, StdCtrls, DBCtrls, Mask,
  Grids, DBGrids, ExtCtrls, Buttons, ComCtrls, ToolWin;

type
  TBookDocu3 = class(TBookDocu)
    procedure BitBtn1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  BookDocu3: TBookDocu3;

implementation

{$R *.dfm}

procedure TBookDocu3.BitBtn1Click(Sender: TObject);
var
condition:integer;
begin
  inherited;
  condition:=7;
  if label3.Visible=false then
    condition:=(condition)and(3);
  if label4.Visible=false then
    condition:=(condition)and(5);
  if label5.Visible=false then
    condition:=(condition)and(6);

  if condition=7 then
    begin
      adoquery1.Close;
      adoquery1.SQL.Clear;
      adoquery1.SQL.Add('select * from '+adotable1.TableName);
      adoquery1.SQL.Add('where(BookInfo_Author like ''%'+edit1.Text+'%'')');
      adoquery1.SQL.Add('and(BookInfo_Type like ''%'+edit2.Text+'%'')');
      adoquery1.SQL.Add('and(BookInfo_PublishingCompany like ''%'+edit3.Text+'%'')');
      adoquery1.Open;
      //
      adotable1.Clone(adoquery1,ltUnspecified);
    end;

  if condition=6 then //
    begin
      adoquery1.Close;
      adoquery1.SQL.Clear;
      adoquery1.SQL.Add('select * from '+adotable1.TableName);
      adoquery1.SQL.Add('where(BookInfo_Type like ''%'+edit2.Text+'%'')');
      adoquery1.SQL.Add('and(BookInfo_Author like''%'+edit2.Text+'%'')');
      adoquery1.Open;
      //
      adoquery1.Clone(adoquery1,ltUnspecified);
    end;

  if condition=4 then //
    begin
      adoquery1.Close;
      adoquery1.SQL.Add('select * from '+adotable1.TableName);
      adoquery1.SQL.Add(' where(BookInfo_Author like ''%'+edit1.Text+'%'')');
      adoquery1.Open;
      //
      adotable1.Clone(adoquery1,ltUnspecified);
    end;
end;


procedure TBookDocu3.FormCreate(Sender: TObject);
begin
  inherited;
toolbar1.visible:=false;
panel1.Enabled:=false;
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?