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

📄 company.pas

📁 小管理程序主要管理的小咖啡厅我是从网上下的经测试可用
💻 PAS
字号:
unit company;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, DB, ADODB;

type
  TFrmcompany = class(TForm)
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    Label3: TLabel;
    Edit2: TEdit;
    Edit3: TEdit;
    SpeedButton1: TSpeedButton;
    SpeedButton2: TSpeedButton;
    ADOQuery1: TADOQuery;
    procedure FormShow(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Frmcompany: TFrmcompany;

implementation
  uses dbmodule;
{$R *.dfm}

procedure TFrmcompany.FormShow(Sender: TObject);
begin
  if adoquery1.Active then
    adoquery1.Close;
  adoquery1.SQL.Clear;
  adoquery1.SQL.Add('select * from Q_company');
  adoquery1.Open;
  edit1.Text:='';
  edit2.Text:='';
  edit3.Text:='';
  if not adoquery1.Eof then
    begin
      edit1.Text :=adoquery1.FieldValues['companyname'];
      edit2.Text :=adoquery1.FieldValues['companytele'];
      edit3.Text :=adoquery1.FieldValues['companyaddr'];
    end;
  adoquery1.Close;
end;

procedure TFrmcompany.SpeedButton1Click(Sender: TObject);
begin
  if adoquery1.Active then
    adoquery1.Close;
  adoquery1.SQL.Clear;
  adoquery1.SQL.Add('delete from Q_company');
  adoquery1.ExecSQL;
  adoquery1.Close;
  adoquery1.SQL.Clear;
  adoquery1.SQL.Add('select * from Q_company');
  adoquery1.Open;
  adoquery1.Append;
  adoquery1.FieldValues['companyname']:=edit1.Text;
  adoquery1.FieldValues['companytele']:=edit2.Text;
  adoquery1.FieldValues['companyaddr']:=edit3.Text ;
  adoquery1.Post;
  adoquery1.Close;
  application.MessageBox('数据保存成功。','提示',mb_ok);
end;

procedure TFrmcompany.SpeedButton2Click(Sender: TObject);
begin
  self.Close;
end;

end.

⌨️ 快捷键说明

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