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

📄 booksettingform.~pas

📁 图书管理系统,使用Delphi开发,数据库为Microsoft SQL Server 2
💻 ~PAS
字号:
unit BookSettingForm;

interface

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

type
  TBookSetting = class(TParent)
    ADOQuery2: TADOQuery;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    DBEdit1: TDBEdit;
    DBEdit2: TDBEdit;
    DBEdit3: TDBEdit;
    procedure DataSource1DataChange(Sender: TObject; Field: TField);
    procedure ToolButton5Click(Sender: TObject);
    procedure ToolButton6Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  BookSetting: TBookSetting;

implementation

{$R *.dfm}
uses
DataMod;

//
procedure TBookSetting.DataSource1DataChange(Sender: TObject;
  Field: TField);
begin
  inherited;
  dbgrid1.Columns[0].Width:=64;
  dbgrid1.Columns[1].Width:=256;
end;

procedure TBookSetting.ToolButton5Click(Sender: TObject);
var
  maxnum:integer;
  newnum,max:string;
begin
  inherited;
  panel1.Enabled:=true;
  //
  adoquery2.Close;
  adoquery2.SQL.Clear;
  adoquery2.SQL.Add('select max(BookType_TypeNo) 最大编号 from BookType');
  adoquery2.Open;
  adoquery2.FieldByName('最大编号');
  //
  max:=trim(adoquery2.FieldByName('最大编号').AsString);
  maxnum:=strtoint(max);
  maxnum:=maxnum+1;
  newnum:=inttostr(maxnum);
  if length(newnum)=1 then
    dbedit1.Text:='00'+newnum;
  if length(newnum)=2 then
    dbedit1.Text:='0'+newnum;
  if length(newnum)=3 then
    dbedit1.Text:=newnum;
end;

procedure TBookSetting.ToolButton6Click(Sender: TObject);
begin
  inherited;
  panel1.Enabled:=true;
end;

procedure TBookSetting.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('+label3.Caption+' like ''%'+edit1.Text+'%'')');
      adoquery1.SQL.Add('and('+label4.Caption+' like ''%'+edit2.Text+'%'')');
      adoquery1.SQL.Add('and('+label5.Caption+' 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( BookType_TypeNo like ''%'+edit1.Text+'%'')');
      adoquery1.SQL.Add('and ( BookType_TypeName like''%'+edit2.Text+'%'')');
      adoquery1.Open;
      //
      adotable1.Clone(adoquery1,ltUnspecified);
    end
  else
  if condition=4 then //
    begin
      adoquery1.Close;
      adoquery1.SQL.Add('select * from '+adotable1.TableName);
      adoquery1.SQL.Add(' where( BookType_TypeNo like ''%'+edit1.Text+'%'')');
      adoquery1.Open;
      //
      adotable1.Clone(adoquery1,ltUnspecified);
    end;
end;

end.

⌨️ 快捷键说明

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