?? goodsunit.~pas
字號(hào):
unit goodsunit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, StdCtrls, DBCtrls, Mask, ExtCtrls, ImgList,
ComCtrls, ToolWin;
type
Tgoodsfrm = class(TForm)
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
ToolButton4: TToolButton;
ToolButton5: TToolButton;
ToolButton6: TToolButton;
ToolButton7: TToolButton;
ToolButton8: TToolButton;
ImageList1: TImageList;
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label6: TLabel;
DBGrid1: TDBGrid;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Memo1: TMemo;
Splitter1: TSplitter;
procedure ToolButton8Click(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure DBGrid1CellClick(Column: TColumn);
procedure ToolButton3Click(Sender: TObject);
procedure ToolButton5Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ToolButton6Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
goodsfrm: Tgoodsfrm;
implementation
uses datamoduleUnit;
{$R *.dfm}
procedure Tgoodsfrm.ToolButton8Click(Sender: TObject);
begin
goodsfrm.Close;
end;
procedure Tgoodsfrm.ToolButton1Click(Sender: TObject);
begin
if (edit1.Text='')or(edit2.Text='')or(edit3.Text='')or(edit4.Text='') then
showmessage('No data put in!')
else
begin
with datamodule2.ADSgoods do
begin
Insert;
FieldByName('商品編號(hào)').AsString:=edit1.Text;
FieldByName('商品名稱').AsString:=edit2.Text;
FieldByName('商品規(guī)格').AsString:=edit3.Text;
FieldByName('計(jì)量單位').AsString:=edit4.Text;
FieldByName('備注信息').AsString:=memo1.Lines.Text;
post;
refresh;
end;
end;
end;
procedure Tgoodsfrm.ToolButton2Click(Sender: TObject);
begin
if (edit1.Text='')or(edit2.Text='')or(edit3.Text='')or(edit4.Text='') then
showmessage('No data put in!')
else
begin
with datamodule2.ADSgoods do
begin
edit;
FieldByName('商品編號(hào)').AsString:=edit1.Text;
FieldByName('商品名稱').AsString:=edit2.Text;
FieldByName('商品規(guī)格').AsString:=edit3.Text;
FieldByName('計(jì)量單位').AsString:=edit4.Text;
FieldByName('備注信息').AsString:=memo1.Lines.Text;
post;
refresh;
end;
end;
end;
procedure Tgoodsfrm.DBGrid1CellClick(Column: TColumn);
begin
with datamodule2.ADSgoods do
begin
edit1.Text:=FieldByName('商品編號(hào)').AsString;
edit2.Text:=FieldByName('商品名稱').AsString;
edit3.Text:=FieldByName('商品規(guī)格').AsString;
edit4.Text:=FieldByName('計(jì)量單位').AsString;
memo1.Lines.Text:=FieldByName('備注信息').AsString;
refresh;
end;
end;
procedure Tgoodsfrm.ToolButton3Click(Sender: TObject);
begin
if MessageDlg('確定刪除嗎?',mtConfirmation, [mbYes, mbNo], 0) = mrYes then
datamodule2.ADSgoods.Delete;
end;
procedure Tgoodsfrm.ToolButton5Click(Sender: TObject);
begin
datamodule2.ADSgoods.Edit;
datamodule2.ADSgoods.Post;
end;
procedure Tgoodsfrm.FormCreate(Sender: TObject);
begin
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit4.Text:='';
end;
procedure Tgoodsfrm.ToolButton6Click(Sender: TObject);
begin
datamodule2.ADSgoods.Cancel;;
end;
end.
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -