?? modisf.pas.~1~
字號(hào):
unit modisf;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, ExtCtrls, DB, DBTables;
type
Tmodisf_Form = class(TForm)
bh_LEdit: TLabeledEdit;
mph_LEdit: TLabeledEdit;
sf_LEdit: TLabeledEdit;
df_LEdit: TLabeledEdit;
qf_LEdit: TLabeledEdit;
wgf_LEdit: TLabeledEdit;
qtf_LEdit: TLabeledEdit;
Label1: TLabel;
sfrq_DTP: TDateTimePicker;
cmdok: TButton;
cmdclose: TButton;
procedure FormCreate(Sender: TObject);
procedure cmdokClick(Sender: TObject);
procedure cmdcloseClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
modisf_Form: Tmodisf_Form;
implementation
uses wgsf;
{$R *.dfm}
procedure Tmodisf_Form.FormCreate(Sender: TObject);
begin
Caption:=wgsf_form.xcaption;
bh_ledit.Text:=wgsf_form.xbh;
//如果此時(shí)為修改窗體,則將選擇的信息賦予對(duì)應(yīng)的控件顯示
if wgsf_form.modi then
begin
mph_ledit.Text:=wgsf_form.Query1.fieldbyname('mph').AsString;
bh_ledit.Text:=wgsf_form.Query1.fieldbyname('bh').AsString;
sf_ledit.Text:=wgsf_form.Query1.fieldbyname('sf').AsString;
df_ledit.Text:=wgsf_form.Query1.fieldbyname('df').AsString;
qf_ledit.Text:=wgsf_form.Query1.fieldbyname('qf').AsString;
wgf_ledit.Text:=wgsf_form.Query1.fieldbyname('wgf').AsString;
qtf_ledit.Text:=wgsf_form.Query1.fieldbyname('qtf').AsString;
sfrq_dtp.DateTime:=wgsf_form.Query1.fieldbyname('sfsj').AsDateTime;
end;
end;
procedure Tmodisf_Form.cmdokClick(Sender: TObject);
var
id,sqlstr,sqlstr1,mph,bh,sf,df,qf,wgf,qtf,sfrq:string;
begin
mph:=trim(mph_ledit.Text);
if length(mph)<1 then
begin
ShowMessage('門牌號(hào)不能為空,請(qǐng)輸入門牌號(hào)');
exit;
end;
bh:=trim(bh_ledit.Text);
sf:=trim(sf_ledit.Text);
df:=trim(df_ledit.Text);
qf:=trim(qf_ledit.Text);
wgf:=trim(wgf_ledit.Text);
qtf:=trim(qtf_ledit.Text);
sfrq:=datetimetostr(sfrq_dtp.DateTime);
if wgsf_form.modi then
begin
id:=wgsf_form.Query1.fieldbyname('id').AsString;
sqlstr:='update t_sfb set mph='''+mph+''',sf='''+sf;
sqlstr:=sqlstr+''',df='''+df+''',qf='''+qf+''',wgf='''+wgf+''',qtf='''+qtf;
sqlstr:=sqlstr+''',sfsj='''+sfrq+''' where (id='''+id+''')';
sqlstr1:='select * from t_sfb where (mph='''+mph+''')and(bh='''+bh+''')and(id<>'''+id+''')';
end
else
begin
sqlstr:='insert into t_sfb(mph,bh,sf,df,qf,wgf,qtf,sfsj) values('''+mph;
sqlstr:=sqlstr+''','''+bh+''','''+sf+''','''+df+''','''+qf;
sqlstr:=sqlstr+''','''+wgf+''','''+qtf+''','''+sfrq+''')';
sqlstr1:='select * from t_sfb where (mph='''+mph+''')and(bh='''+bh+''')';
end;
with tquery.Create(nil) do
begin
try
Close;
SQL.Clear;
SQL.Add(sqlstr1);
Open;
if RecordCount > 0 then
begin
ShowMessage('輸入的門牌號(hào)在該月已經(jīng)重復(fù),請(qǐng)重新輸入');
exit;
end;
ShowMessage(sqlstr);
Close;
SQL.Clear;
SQL.Add(sqlstr);
ExecSQL;
finally
Free;
end;
end;
Close;
wgsf_form.cmdok.Click;
end;
procedure Tmodisf_Form.cmdcloseClick(Sender: TObject);
begin
Close;
end;
end.
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -