?? addbankform.~pas
字號(hào):
unit AddBankForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, DBGrids, DB;
type
TAddBank = class(TForm)
GroupBox1: TGroupBox;
ComboBox1: TComboBox;
Label1: TLabel;
Edit1: TEdit;
Label2: TLabel;
Edit2: TEdit;
Label3: TLabel;
Edit3: TEdit;
Label4: TLabel;
Edit4: TEdit;
GroupBox2: TGroupBox;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
Button1: TButton;
GroupBox3: TGroupBox;
ComboBox2: TComboBox;
Button2: TButton;
GroupBox4: TGroupBox;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
AddBank: TAddBank;
implementation
uses DMForm;
{$R *.dfm}
procedure TAddBank.FormCreate(Sender: TObject);
begin
with dm.ADOQuery4 do
begin
dm.adoquery4.Close ;
dm.adoquery4.Open ;
while not dm.adoquery4.Eof do
begin
ComboBox2.Items.Add(dm.adoquery4.FieldByName('銀行帳號(hào)').AsString);
dm.adoquery4.Next
end;
end;
with dm.ADOQuery3 do
begin
dm.adoquery3.Close ;
dm.adoquery3.Open ;
while not dm.adoquery3.Eof do
begin
ComboBox1.Items.Add(dm.adoquery3.FieldByName('成員姓名').AsString);
dm.adoquery3.Next
end;
end;
end;
procedure TAddBank.Button1Click(Sender: TObject);
var
tmptype : boolean;
begin
if ComboBox1.Text = '開戶人' then
messagebox(getactivewindow(),'請(qǐng)選擇開戶人的姓名!','錯(cuò)誤!' ,MB_OK + MB_ICONINFORMATION)
else if (radiobutton1.Checked = false) and (radiobutton2.Checked = false) then
messagebox(getactivewindow(),'請(qǐng)選擇存款類型!','錯(cuò)誤' ,MB_OK + MB_ICONINFORMATION)
else if edit1.Text = '' then
messagebox(getactivewindow(),'請(qǐng)?zhí)顚戦_戶人的身份證號(hào)!','錯(cuò)誤' ,MB_OK + MB_ICONINFORMATION)
else if edit2.Text = '' then
messagebox(getactivewindow(),'請(qǐng)?zhí)顚懘骈_戶的銀行!','錯(cuò)誤' ,MB_OK + MB_ICONINFORMATION)
else if edit3.Text = '' then
messagebox(getactivewindow(),'請(qǐng)?zhí)顚懘婵畹慕痤~數(shù)量!','錯(cuò)誤' ,MB_OK + MB_ICONINFORMATION)
else if edit4.Text = '' then
messagebox(getactivewindow(),'請(qǐng)?zhí)鞂戙y行的帳號(hào)!','錯(cuò)誤' ,MB_OK + MB_ICONINFORMATION)
else
begin
if radiobutton1.Checked then //是否為活期
tmptype := false
else
tmptype := true;
DM.User.Close;
DM.User.SQL.Clear;
DM.User.SQL.Add('INSERT INTO bank (銀行帳號(hào),開戶銀行,是否定期,存款金額,開戶人,開戶人身份證) VALUES (:no1,:no2,:no3,:no4,:no5,:no6)');
DM.User.Parameters.ParamByName('no1').Value := edit4.Text;
DM.User.Parameters.ParamByName('no2').Value := edit2.Text;
DM.User.Parameters.ParamByName('no3').Value := tmptype;
DM.User.Parameters.ParamByName('no4').Value := edit3.Text;
DM.User.Parameters.ParamByName('no5').Value := ComboBox1.Text;
DM.User.Parameters.ParamByName('no6').Value := edit1.Text;
DM.User.Prepared;
DM.User.ExecSql;
messagebox(getactivewindow(),'添加銀行帳戶成功,單擊確定返回!','成功添加' ,MB_OK + MB_ICONINFORMATION);
dm.adotable4.active:=false;
dm.adotable4.active:=true;
edit1.Text := '' ;
edit2.Text := '' ;
edit3.Text := '' ;
edit4.Text := '' ;
ComboBox1.Text := '開戶人' ;
Combobox2.Items.Clear;
with dm.ADOQuery4 do
begin
dm.adoquery4.Close ;
dm.adoquery4.Open ;
while not dm.adoquery4.Eof do
begin
ComboBox2.Items.Add(dm.adoquery4.FieldByName('銀行帳號(hào)').AsString);
dm.adoquery4.Next
end;
end;
end;
end;
procedure TAddBank.Button2Click(Sender: TObject);
begin
if combobox2.Text = '請(qǐng)選擇要?jiǎng)h除的銀行帳號(hào)' then
messagebox(getactivewindow(),'您沒有選擇任何帳號(hào),請(qǐng)選擇!','請(qǐng)重新選擇' ,MB_OK + MB_ICONINFORMATION)
else
begin
dm.User.Close;
dm.User.SQL.Clear;
dm.User.SQL.Add('DELETE * FROM bank WHERE 銀行帳號(hào) = :user');
dm.User.Parameters.ParamByName('user').Value := combobox2.Text;
dm.User.Prepared;
dm.User.ExecSql;
messagebox(getactivewindow(),'刪除帳號(hào)成功,單擊確定返回!','成功刪除' ,MB_OK + MB_ICONINFORMATION);
combobox2.Text := '請(qǐng)選擇要?jiǎng)h除的銀行帳號(hào)';
dm.adotable4.active:=false;
dm.adotable4.active:=true;
combobox2.Items.Clear;
with dm.ADOQuery4 do
begin
dm.adoquery4.Close ;
dm.adoquery4.Open ;
while not dm.adoquery4.Eof do
begin
ComboBox2.Items.Add(dm.adoquery4.FieldByName('銀行帳號(hào)').AsString);
dm.adoquery4.Next
end;
end;
end;
end;
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -