?? unit6.pas
字號(hào):
unit Unit6;
//宿舍信息
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, Grids, DBGrids, DB;
type
Tfrm_ssxx = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
ComboBox3: TComboBox;
ComboBox4: TComboBox;
ComboBox5: TComboBox;
Edit1: TEdit;
Memo1: TMemo;
Button1: TButton;
Button2: TButton;
Edit6: TEdit;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_ssxx: Tfrm_ssxx;
implementation
uses Unit13;
{$R *.dfm}
//-----------------------顯示選擇信息------------------//
procedure Tfrm_ssxx.FormCreate(Sender: TObject);
begin
with data1.ADO_public do
begin
close;
sql.Clear;
sql.Add('select * from 宿舍管理');
open;
end;
while Not Data1.ADO_public.Eof do
begin
ComboBox1.Items.Add(Data1.ADO_public.FieldByName('樓房號(hào)').Value);
ComboBox2.Items.Add(Data1.ADO_public.FieldByName('房間價(jià)格').Value);
combobox3.Items.Add(data1.ADO_public.fieldByName('入住人數(shù)').Value);
Data1.ADO_public.Next;
end;
end;
//---------------------------信息添加-------------------//
procedure Tfrm_ssxx.Button1Click(Sender: TObject);
begin
if Edit1.Text ='' then
begin
MessageBox(handle,'宿舍號(hào)不能為空!','警告',MB_OK+MB_ICONWARNING);
Edit1.SetFocus ;
exit;
end;
if combobox1.Text ='' then
begin
MessageBox(handle,'樓房號(hào)不能為空!','警告',MB_OK+MB_ICONWARNING);
combobox1.SetFocus ;
exit;
end;
if combobox3.Text ='' then
begin
MessageBox(handle,'應(yīng)住人數(shù)不能為空!','警告',MB_OK+MB_ICONWARNING);
combobox3.SetFocus ;
exit;
end;
try
with data1.ADO_ssxx do
begin
close;
sql.Clear;
sql.Add('insert 宿舍信息 values (:a,:b,:c,:d,:e,:f,:g,:h)');
parameters.ParamByName('a').Value:=trim(combobox1.Text) + '-' +trim(edit1.Text);
parameters.ParamByName('b').Value:=trim(combobox3.Text);
parameters.ParamByName('c').Value:='';
parameters.ParamByName('d').Value:=trim(combobox5.Text);
parameters.ParamByName('e').Value:=trim(combobox2.Text);
parameters.ParamByName('f').Value:=trim(combobox4.Text);
parameters.ParamByName('g').Value:=trim(edit6.Text);
parameters.ParamByName('h').Value:=trim(memo1.Text);
execsql;
end;
application.MessageBox('添加成功','提示',64);
except
application.MessageBox('添加失敗','提示',64);
end;
end;
//----------------------取消--------------------//
procedure Tfrm_ssxx.Button2Click(Sender: TObject);
begin
close;
end;
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -