?? mc_fwxxscq.pas
字號(hào):
unit MC_FWXXSCQ;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, DBTables, DBCtrls, StdCtrls, Grids, DBGrids, ComCtrls, ExtCtrls,
Buttons;
type
TFWXXSCQ = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
DBLookupComboBox1: TDBLookupComboBox;
DataSource1: TDataSource;
Query1: TQuery;
Query1BDEDesigner: TStringField;
Query1BDEDesigner2: TStringField;
GroupBox2: TGroupBox;
GroupBox3: TGroupBox;
Table1: TTable;
DataSource2: TDataSource;
Table1BDEDesigner: TStringField;
Table1BDEDesigner2: TStringField;
Table1BDEDesigner3: TStringField;
DBGrid1: TDBGrid;
Bevel1: TBevel;
Label11: TLabel;
Label12: TLabel;
Label9: TLabel;
Label7: TLabel;
Label8: TLabel;
DBLookupComboBox2: TDBLookupComboBox;
DBLookupComboBox3: TDBLookupComboBox;
DBLookupComboBox4: TDBLookupComboBox;
DBLookupComboBox5: TDBLookupComboBox;
DBLookupComboBox6: TDBLookupComboBox;
DataSource3: TDataSource;
Query2: TQuery;
Query2BDEDesigner: TStringField;
DataSource4: TDataSource;
Query3: TQuery;
Query3BDEDesigner: TStringField;
DataSource5: TDataSource;
Query4: TQuery;
Query4BDEDesigner: TStringField;
DataSource6: TDataSource;
Query5: TQuery;
Query5BDEDesigner: TStringField;
DataSource7: TDataSource;
Query6: TQuery;
Query6BDEDesigner: TStringField;
Bevel2: TBevel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Bevel3: TBevel;
Label4: TLabel;
Query7: TQuery;
Label5: TLabel;
Label6: TLabel;
Edit3: TEdit;
UpDown3: TUpDown;
Edit4: TEdit;
UpDown4: TUpDown;
Label10: TLabel;
Edit5: TEdit;
UpDown5: TUpDown;
Label13: TLabel;
Edit6: TEdit;
UpDown6: TUpDown;
procedure BitBtn2Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FWXXSCQ: TFWXXSCQ;
implementation
uses MC_MainForm;
{$R *.DFM}
procedure TFWXXSCQ.FormShow(Sender: TObject);
begin
DBLookupComboBox1.KeyValue:=Query1.FieldByName('小區(qū)名').AsString;
DBLookupComboBox2.KeyValue:=Query2.FieldByName('房屋朝向').AsString;
DBLookupComboBox3.KeyValue:=Query3.FieldByName('權(quán)屬類型').AsString;
DBLookupComboBox4.KeyValue:=Query4.FieldByName('房間結(jié)構(gòu)').AsString;
DBLookupComboBox5.KeyValue:=Query5.FieldByName('配備信息').AsString;
DBLookupComboBox6.KeyValue:=Query6.FieldByName('房間類別').AsString;
if MainForm.Query1.Locate('使用選項(xiàng)','房屋信息生成',[loCaseInsensitive]) then
begin
if MainForm.Query1.FieldByname('讀寫(xiě)').AsString='讀' then
begin
Bitbtn1.Enabled:=False;
end;
end;
end;
procedure TFWXXSCQ.BitBtn1Click(Sender: TObject);
var FJH,a,b,c:integer;
begin
For a:=StrToInt(Edit3.Text) to StrToInt(Edit4.Text) do
begin
For b:=1 to StrToInt(Edit5.Text) do
begin
For c:=1 to StrToInt(Edit6.Text) do
begin
Query7.Close;
Query7.SQL.Clear;
Query7.SQL.Add('Insert 房屋信息表(房間編號(hào),區(qū)名,大樓編號(hào),大樓名,房間號(hào)碼,朝向,權(quán)屬類型,房間結(jié)構(gòu),配備設(shè)施,房間類別,單元,樓層)');
Query7.SQL.Add('Values(:A,:B,:N1,:C,:D,:E,:F,:G,:H,:J,:M,:N)');
Query7.ParamByName('A').AsString:=DBLookupComboBox1.keyValue
+Table1.FieldByName('大樓名稱').AsString
+IntToStr(a)+IntToStr(b)+'0'+IntToStr(C);
Query7.ParamByName('B').AsString:=DBLookupComboBox1.KeyValue;
Query7.ParamByName('C').AsString:=Table1.FieldbyName('大樓名稱').AsString;
Query7.ParamByName('D').AsString:=IntToStr(a)+IntToStr(b)+'0'+IntToStr(C);
Query7.ParamByName('E').AsString:=DBLookupComboBox2.KeyValue;
Query7.ParamByName('F').AsString:=DBLookupComboBox3.KeyValue;
Query7.ParamByName('G').AsString:=DBLookupComboBox4.KeyValue;
Query7.ParamByName('H').AsString:=DBLookupComboBox5.KeyValue;
Query7.ParamByName('J').AsString:=DBLookupComboBox6.KeyValue;
Query7.ParamByName('M').AsSTring:=IntToStr(a);
Query7.ParamByName('N').AsString:=IntTostr(b);
Query7.ParamByName('N1').AsString:=Table1.FieldByName('大樓編號(hào)').AsString;
Try
Query7.ExecSQL;
Except
begin
ShowMessage('重復(fù)房間號(hào),此房屋已存在.');
Exit;
end;
end;
end;
end;
end;
ShowMessage('生成完畢');
end;
procedure TFWXXSCQ.BitBtn2Click(Sender: TObject);
begin
Close;
end;
procedure TFWXXSCQ.FormClose(Sender: TObject; var Action: TCloseAction);
begin
FWXXSCQ.Release;
FWXXSCQ:=Nil;
end;
end.
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -