⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit2.pas

📁 是用DELPHI编写的图书管理系统
💻 PAS
字号:
unit Unit2;

interface

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

type
  TFormtscx = class(TForm)
    Panel1: TPanel;
    DBGridtscx: TDBGrid;
    GroupBox1: TGroupBox;
    ComboBoxgjz: TComboBox;
    Label1: TLabel;
    Label2: TLabel;
    btncx: TButton;
    btnfh: TButton;
    DataSourcetscx: TDataSource;
    Querytscx: TQuery;
    Editgjz: TEdit;
    procedure btncxClick(Sender: TObject);
    procedure btnfhClick(Sender: TObject);
    procedure ComboBoxgjzChange(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Formtscx: TFormtscx;

implementation

{$R *.dfm}

procedure TFormtscx.btncxClick(Sender: TObject);
var gjz,gjzsz:string;
begin
gjz:=comboboxgjz.Text ;
gjzsz:=editgjz.Text ;
if(gjz=' ')and(gjzsz=' ') then
  with querytscx do
     begin
     close;
     sql.Clear ;
     sql.Add('select *');
     sql.Add('from tsbm');
     sql.Add('order by 图书编号');
     prepare;
     open;
     end
  else if(gjz<>'')and(gjzsz='') then
     showmessage('请输入“查询关键字设置”信息!!!' )
  else if(gjz='')and(gjzsz<>'') then
     showmessage('请输入“查询关键字选择”信息!!!' )
 else
  begin
   gjzsz:=gjzsz+'%';
   if gjz='图书编号' then
     with querytscx do
     begin
     close;
     sql.Clear ;
     sql.Add('select *');
     sql.Add('from tsbm');
     sql.Add('where 图书编号 like:gjzszname')  ;
     sql.Add('order by 图书编号');
     parambyname('gjzszname').AsString :=gjzsz;
     prepare;
     open;
     end
  else if gjz='图书名称' then
     with querytscx do
     begin
     close;
     sql.Clear ;
     sql.Add('select *');
     sql.Add('from tsbm');
     sql.Add('where 图书名称 like:gjzszname')  ;
     sql.Add('order by 图书编号');
     parambyname('gjzszname').AsString :=gjzsz;
     prepare;
     open;
     end

  else if gjz='图书类别' then
     with querytscx do
     begin
     close;
     sql.Clear ;
     sql.Add('select *');
     sql.Add('from tsbm');
     sql.Add('where 图书类别 like:gjzszname')  ;
     sql.Add('order by 图书编号');
     parambyname('gjzszname').AsString :=gjzsz;
     prepare;
     open;
     end
 else if gjz='作者姓名' then
     with querytscx do
     begin
     close;
     sql.Clear ;
     sql.Add('select *');
     sql.Add('from tsbm');
     sql.Add('where 作者姓名 like:gjzszname')  ;
     sql.Add('order by 图书编号');
     parambyname('gjzszname').AsString :=gjzsz;
     prepare;
     open;
     end
 else if gjz='出版社' then
     with querytscx do
     begin
     close;
     sql.Clear ;
     sql.Add('select *');
     sql.Add('from tsbm');
     sql.Add('where 出版社 like:gjzszname')  ;
     sql.Add('order by 图书编号');
     parambyname('gjzszname').AsString :=gjzsz;
     prepare;
     open;
     end ;
     end;

end;

procedure TFormtscx.btnfhClick(Sender: TObject);
begin
close;
end;

procedure TFormtscx.ComboBoxgjzChange(Sender: TObject);
begin
editgjz.Text:='';
end;

end.

⌨️ 快捷键说明

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