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

📄 uspkccx.~pas

📁 delphi 开发的完整的仓库管理系统(带数据库)
💻 ~PAS
字号:
unit USPKCCX;

interface

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

type
  TSPKCCX = class(TForm)
    DBGrid1: TDBGrid;
    Label1: TLabel;
    ComboBox1: TComboBox;
    Bevel1: TBevel;
    SpeedButton1: TSpeedButton;
    SpeedButton2: TSpeedButton;
    procedure ComboBox1DropDown(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure ComboBox1KeyPress(Sender: TObject; var Key: Char);
    procedure SpeedButton2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  SPKCCX: TSPKCCX;

implementation

uses UMAIN, UDM;

{$R *.dfm}

procedure TSPKCCX.ComboBox1DropDown(Sender: TObject);
var
  i:integer;
begin
  ComboBox1.Clear;
  with DM.QKCB do
  begin
    SQL.clear;
    SQl.Text := 'select 商品名称 from 库存表';
    Close;
    Active := False;
    prepared := False;
    prepared := True;
    Active := True;
    if (recordcount > 0) then
      first;
    for i := 0 to recordcount - 1 do
    begin
      combobox1.Items.add(FieldByName('商品名称').asstring);
      next;
    end;
  end;
end;

procedure TSPKCCX.SpeedButton1Click(Sender: TObject);
begin
  if ComboBox1.Text<>'' then
  begin
    with DM.QKCB do
    begin
      Close;
      SQL.Clear;
      SQL.text:='Select * from 库存表 where 商品名称 like'+#39+'%'+trim(ComboBox1.Text)+'%'+#39;
      Open;
      DBGrid1.DataSource:=DM.DataSource5;
    end;
  end;
end;

procedure TSPKCCX.ComboBox1KeyPress(Sender: TObject; var Key: Char);
begin
  if not (key in[#13]) then
    key:=#0;
end;

procedure TSPKCCX.SpeedButton2Click(Sender: TObject);
begin
  ComboBox1.Clear;
  with DM.QKCB do
  begin
    Close;
    SQL.Clear;
    SQL.Add('Select * from 库存表');
    Open;
  end;
  DBGrid1.DataSource:=DM.DataSource5;
end;

end.

⌨️ 快捷键说明

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