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

📄 unit3.pas

📁 用Delphi做一个公寓管理系统
💻 PAS
字号:
unit Unit3;

interface

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

type
  TForm_floorconfig2 = class(TForm)
    ComboBox_sex: TComboBox;
    Label1: TLabel;
    ComboBox_namNum: TComboBox;
    Label2: TLabel;
    Button1: TButton;
    Button3: TButton;
    Memo1: TMemo;
    Label3: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form_floorconfig2: TForm_floorconfig2;

implementation

uses Unit2;

{$R *.dfm}

procedure TForm_floorconfig2.Button1Click(Sender: TObject);
begin
  Form_floorconfig1.Show;
end;

procedure TForm_floorconfig2.Button3Click(Sender: TObject);

var floorcount,roomcount :integer;
    f,r :integer;
begin
  floorcount:=strtoint(Form_floorconfig1.Edit_floorcount.Text);
  roomcount:=strtoint(Form_floorconfig1.Edit_roomcount.Text);
  for f:=1 to floorcount do
    begin
      for r:=1 to roomcount do
        begin
          Form_floorconfig1.query1.Close;
          Form_floorconfig1.query1.SQL.Clear;
          Form_floorconfig1.query1.SQL.Add('insert into room(Num_room,sex,sum_a,remark) values(:x1,:x2,:x3,:x4)');
          if r<10 then
            Form_floorconfig1.query1.parambyname('x1').asstring:=Form_floorconfig1.Edit_floorNum.Text+inttostr(f)+'0'+inttostr(r)
          else
            Form_floorconfig1.query1.parambyname('x1').asstring:=Form_floorconfig1.Edit_floorNum.Text+inttostr(f)+inttostr(r);
          Form_floorconfig1.query1.parambyname('x2').asstring:=ComboBox_sex.Text;
          Form_floorconfig1.query1.parambyname('x3').AsInteger:=strtoint(ComboBox_namNum.Text);
          Form_floorconfig1.query1.parambyname('x4').AsString:=Memo1.Text;

          Form_floorconfig1.query1.ExecSQL;
        end;
    end;
    showmessage('操作成功!');
    Form_floorconfig2.Close;
    Form_floorconfig1.Close;
end;

end.

⌨️ 快捷键说明

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