A
asir
Unregistered / Unconfirmed
GUEST, unregistred user!
小弟初学delphi,谢了一个小的程序,不过还没完,就有了问题:
我在一个from中的一个butten设为“添加”但是运行事出现了:
Error: Unit2.pas{56}StatementExpected but 'PROCDEURE'found.
[FatalError]Manage.dpr(8):Could not complile use "Unit2.pass"
附源程序:
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Grids, DBGrids, DB, DBTables, Buttons;
type
Tfrm_worker = class(TForm)
Label1: TLabel;
Label2: TLabel;
Image1: TImage;
BitBtn1: TBitBtn;
Table1: TTable;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_worker: Tfrm_worker;
implementation
{$R *.dfm}
procedure Tfrm_worker.BitBtn1Click(Sender: TObject);
begin
self.Close;
end;
procedure Tfrm_worker.BitBtn2Click(Sender: TObject);
var
id:integer;
begin
with table1 do
begin
last;
id:=fieldbyname('序号').asinteger;
append;
edit;
fieldbyname('序号').asinteger:=id+1;
post;
end;
procedure Tfrm_worker.BitBtn3Click(Sender: TObject);
begin
if table1.RecordCount>0 then
begin
if messagedlg('你真的要删除吗?',mtconfirmation,[mbyes,mbno],0)=mryes then
table1.Delete;
end
else
messagedlg('无记录可删除!',mtwarning,[mbyes],0);
end;
end.
我在一个from中的一个butten设为“添加”但是运行事出现了:
Error: Unit2.pas{56}StatementExpected but 'PROCDEURE'found.
[FatalError]Manage.dpr(8):Could not complile use "Unit2.pass"
附源程序:
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Grids, DBGrids, DB, DBTables, Buttons;
type
Tfrm_worker = class(TForm)
Label1: TLabel;
Label2: TLabel;
Image1: TImage;
BitBtn1: TBitBtn;
Table1: TTable;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_worker: Tfrm_worker;
implementation
{$R *.dfm}
procedure Tfrm_worker.BitBtn1Click(Sender: TObject);
begin
self.Close;
end;
procedure Tfrm_worker.BitBtn2Click(Sender: TObject);
var
id:integer;
begin
with table1 do
begin
last;
id:=fieldbyname('序号').asinteger;
append;
edit;
fieldbyname('序号').asinteger:=id+1;
post;
end;
procedure Tfrm_worker.BitBtn3Click(Sender: TObject);
begin
if table1.RecordCount>0 then
begin
if messagedlg('你真的要删除吗?',mtconfirmation,[mbyes,mbno],0)=mryes then
table1.Delete;
end
else
messagedlg('无记录可删除!',mtwarning,[mbyes],0);
end;
end.