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

📄 unit5.~pas

📁 个人理财系统可以添加
💻 ~PAS
字号:
unit Unit5;

interface

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

type
  Tsearchform = class(TForm)
    Panel1: TPanel;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    ComboBox3: TComboBox;
    ComboBox4: TComboBox;
    ComboBox5: TComboBox;
    ComboBox6: TComboBox;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    comb: TComboBox;
    BitBtn3: TBitBtn;
    DBGrid1: TDBGrid;
    searchquery: TQuery;
    DataSource1: TDataSource;
    procedure Button2Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure issqladd;
    procedure BitBtn3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  searchform: Tsearchform;

implementation
     uses unit1;
procedure Tsearchform.issqladd;
var date1,date2:Tdatetime;
  str1,str2:string;
begin
   str1:=combobox1.Items[combobox1.itemindex]+'-'+combobox2.Items[combobox2.itemindex]+'-'+combobox3.Items[combobox3.itemindex];
   str2:=combobox4.Items[combobox4.itemindex]+'-'+combobox5.Items[combobox5.itemindex]+'-'+combobox6.Items[combobox6.itemindex];
   date1:=strtodate(str1);
   date2:=strtodate(str2);
   searchquery.Close;
   searchquery.SQL.Clear;
   searchquery.SQL.Add('select * from ');
   searchquery.SQL.Add(mima.usedit.Text+'.db');
   searchquery.SQL.Add('where indate between :date1 and :date2 or outdate between :date3 and :date4');
   searchquery.Params[0].Value:=date1;
   searchquery.Params[1].Value:=date2;
   searchquery.Params[2].Value:=date1;
   searchquery.Params[3].Value:=date2;
end;
{$R *.dfm}

procedure Tsearchform.Button2Click(Sender: TObject);
begin
application.Terminate; 
end;

procedure Tsearchform.BitBtn1Click(Sender: TObject);
begin
   searchquery.Close;
   searchquery.SQL.Clear;
   searchquery.SQL.Add('select * from ');
   searchquery.SQL.Add(mima.usedit.Text+'.db');
   searchquery.SQL.Add('where inclass=:in or outclass=:oc');
   searchquery.Params[0].Value:=comb.Items[comb.ItemIndex];
   searchquery.Params[1].Value:=comb.Items[comb.ItemIndex];
   searchquery.Open;
end;

procedure Tsearchform.BitBtn2Click(Sender: TObject);
begin
   searchform.issqladd;//调用过程
   searchquery.Open;
end;

procedure Tsearchform.FormCreate(Sender: TObject);
begin
   searchquery.DatabaseName:=sysutils.GetCurrentDir+'\database';
   DBGrid1.DataSource:=DataSource1;
   DataSource1.DataSet:=searchquery;
   searchquery.Close;
end;

procedure Tsearchform.BitBtn3Click(Sender: TObject);
begin
  searchform.issqladd;//调用过程
  searchquery.SQL.Add('and (inclass=:in or outclass=:oc)');
  searchquery.Params[4].Value:=comb.Items[comb.ItemIndex];
  searchquery.Params[5].Value:=comb.Items[comb.ItemIndex];
  searchquery.Open;
end;

end.

⌨️ 快捷键说明

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