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

📄 find.pas

📁 一个旅行社管理系统,我也不太了解用什么开发的,反正能运行可看源码.
💻 PAS
字号:
unit Find;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DateM, DB, Grids, DBGrids, StdCtrls, BaseGrid, AdvGrid, Buttons;

type
  TForm3 = class(TForm)
    Edit1: TEdit;
    DBGrid1: TDBGrid;
    StringGrid1: TAdvStringGrid;
    ListBox1: TListBox;
    Label1: TLabel;
    SpeedButton1: TSpeedButton;
    ComboBox1: TComboBox;
    Label2: TLabel;
    procedure ListBox1Click(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
      DataCol: Integer; Column: TColumn; State: TGridDrawState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form3: TForm3;

implementation

{$R *.dfm}

procedure TForm3.ListBox1Click(Sender: TObject);
var SelNo :string;
    ShowI :integer;
begin
  SelNo := ListBox1.Items[ListBox1.itemindex];  //根据流水号查询
  try
    with dm.ADOQuery1 do
    begin
      Close;
      SQL.Clear;
      SQL.Add('select * from MDate where 表单号=:no');
      Parameters.ParambyName('no').Value :=SelNo;
      Open;  //显示主库数据
      StringGrid1.ColCount := FieldCount;
      For ShowI:=0 to FieldCount-1 do
      begin
        StringGrid1.Cells[ShowI,0] := Fields.Fields[ShowI].FieldName;
        StringGrid1.Cells[ShowI,1] := Fields.Fields[ShowI].AsString;
      end;
      Close;
    end;

    with dm.ADOQuery2 do
    begin
      Close;
      SQL.Clear;
      SQL.Add('select * from CDate where 表单号=:no');
      Parameters.ParambyName('no').Value :=SelNo;
      Open;  //显示主库数据
    end;
  except
    showMessage('查询并显示数据库内容时失败!');
  end;

end;

procedure TForm3.SpeedButton1Click(Sender: TObject);
begin
  try
  begin //开始其它查询
      with dm.ADOQuery1 do
      begin
        Close;
        SQL.Clear;
        if ComboBox1.Text='姓名'  then
        begin
        SQL.Add('select b.* from Mdate a '+
         'inner join Cdate b on a.表单号=b.表单号 where 姓名=:z');
        Parameters.ParambyName('z').Value :=edit1.Text;
         Open;
        end;
        if ComboBox1.Text='表单号' then
        begin
          SQL.Add('select * from MDate where 表单号 =:z');
          Parameters.ParamByName('z').value := Edit1.text;
          Open;
        end;
        if ComboBox1.Text='全部' then
        begin
          SQL.Add('select * from MDate ');
          Open;
        end;
      end;

  with dm.ADOQuery1 do   //开始添加数据
    begin
      ListBox1.Items.Clear;
      while not Eof do
      begin
        ListBox1.Items.Add(FieldByName('表单号').AsString);
        Next;
      end;
      Close;
    end;
    end;
  except
    showMessage('查询系统数据库时失败!');
    dm.ADOQuery1.Close;
  end;
end;

procedure TForm3.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
  DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
  if (dm.ADOQuery2.RecNo mod 2) = 1 then
  begin
     with DBGrid1 do
     begin
        canvas.brush.color:= $00F2D5D0;
        DefaultDrawColumnCell(Rect, DataCol,Column,State);
     end;
  end;
end;

end.

⌨️ 快捷键说明

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