?? unit2.pas
字號:
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, DB, ADODB, ExtCtrls, jpeg;
type
Tjbxxlr = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
jbxxlr: TGroupBox;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Edit9: TEdit;
Edit10: TEdit;
Edit11: TEdit;
Edit12: TEdit;
Label12: TLabel;
Label13: TLabel;
Edit13: TEdit;
Edit14: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Label3: TLabel;
Edit3: TEdit;
StatusBar1: TStatusBar;
ADOQuery1: TADOQuery;
ComboBox1: TComboBox;
Label14: TLabel;
Image1: TImage;
DateTimePicker1: TDateTimePicker;
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure Edit13KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;
var
jbxxlr: Tjbxxlr;
implementation
uses unit1;
{$R *.dfm}
procedure Tjbxxlr.Button3Click(Sender: TObject);
begin
self.Close;
end;
procedure Tjbxxlr.Button2Click(Sender: TObject);
begin
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit5.Text:='';
edit6.Text:='';
edit6.Text:='';
edit7.Text:='';
edit8.Text:='';
edit9.Text:='';
edit10.Text:='';
edit11.Text:='';
edit12.Text:='';
edit13.Text:='';
edit14.Text:='';
end;
procedure Tjbxxlr.Button1Click(Sender: TObject);
var
sqlstr:string;
begin
begin
sqlstr:='select *from t_information';
Adoquery1.Close;
ADOquery1.SQL.Clear;
ADOquery1.SQL.Add(sqlstr);
ADOquery1.Open;
end;
if(edit1.Text='')then
begin
application.MessageBox('下面輸入內容不能為空','錯誤提示',0+64);
exit;
end;
if(edit2.Text='')then
begin
application.MessageBox('下面輸入內容不能為空','錯誤提示',0+64);
exit;
end;
if(edit3.Text='')then
begin
application.MessageBox('下面輸入內容不能為空','錯誤提示',0+64);
exit;
end;
if(edit5.Text='')then
begin
application.MessageBox('下面輸入內容不能為空','錯誤提示',0+64);
exit;
end;
if(edit6.Text='')then
begin
application.MessageBox('下面輸入內容不能為空','錯誤提示',0+64);
exit;
end;
if(edit7.Text='')then
begin
application.MessageBox('下面輸入內容不能為空','錯誤提示',0+64);
exit;
end;
if(edit8.Text='')then
begin
application.MessageBox('下面輸入內容不能為空','錯誤提示',0+64);
exit;
end;
if(edit9.Text='')then
begin
application.MessageBox('下面輸入內容不能為空','錯誤提示',0+64);
exit;
end;
if(edit10.Text='')then
begin
application.MessageBox('下面輸入內容不能為空','錯誤提示',0+64);
exit;
end;
if(edit11.Text='')then
begin
application.MessageBox('下面輸入內容不能為空','錯誤提示',0+64);
exit;
end;
if(edit12.Text='')then
begin
application.MessageBox('下面輸入內容不能為空','錯誤提示',0+64);
exit;
end;
if(edit13.Text='')then
begin
application.MessageBox('下面輸入內容不能為空','錯誤提示',0+64);
exit;
end;
if(edit14.Text='')then
begin
application.MessageBox('下面輸入內容不能為空','錯誤提示',0+64);
exit;
end;
with ADOquery1 do
begin
append;
fieldvalues['學號']:=edit1.Text;
fieldvalues['姓名']:=edit2.Text;
fieldvalues['性別']:=ComboBox1.Text;
fieldvalues['學制']:=edit3.Text;
fieldvalues['出生年月']:=datetimepicker1.Time;
fieldvalues['民族']:=edit5.Text;
fieldvalues['籍貫']:=edit6.Text;
fieldvalues['所在系別']:=edit7.Text;
fieldvalues['所在班級']:=edit8.Text;
fieldvalues['所學專業']:=edit9.Text;
fieldvalues['政治面貌']:=edit10.Text;
fieldvalues['入學時間']:=edit11.Text;
fieldvalues['家庭住址']:=edit12.Text;
fieldvalues['郵政編碼']:=edit13.Text;
fieldvalues['聯系電話']:=edit14.Text;
try
post;
except
Application.MessageBox('學號重復,請重新輸入!','警告',0+64);
delete;
edit1.SetFocus;
edit1.SelectAll;
exit;
end;
end;
end;
procedure Tjbxxlr.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in['0'..'9',#8])then
begin
key:=#0;
Application.MessageBox('學號只能填寫數字','警告',0+64)
end;
end;
procedure Tjbxxlr.Edit13KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in['0'..'9',#8])then
begin
key:=#0;
Application.MessageBox('郵政編碼只能有數字','警告',0+64)
end;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -