求帮忙查看Dephi中某个单元的错误!!!
unit Unit25;interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, StdCtrls, ExtCtrls;
type
TForm25 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
ADOQuery1: TADOQuery;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Button1: TButton;
Button2: TButton;
Edit4: TEdit;
Label4: TLabel;
ADOQuery2: TADOQuery;
ADOQuery3: TADOQuery;
ADOQuery4: TADOQuery;
Image1: TImage;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
xh:string;
cn:integer;
ch:integer;
var
Form25: TForm25;
implementation
uses Unit2, Unit4, Unit13;
{$R *.dfm}
procedure TForm25.Button1Click(Sender: TObject);
var
i: LongInt;
f: Double;
begin
if TryStrToInt(Edit4.Text,i) or TryStrToFloat(Edit4.Text, f) then
begin
if xh='' then
begin
with ADOQuery1 do
begin
close;
sql.Clear ;
sql.add('select * from jibenxinxi');
open;
Append;
FieldValues['序号']:=Edit1.text;
FieldValues['名称']:=Edit2.text;
FieldValues['规格']:=Edit3.text;
FieldValues['数量']:=Edit4.text;
post;
showmessage('清单记录增加成功!');
if cn=1 then
begin
with ADOQuery4 do
begin
close;
sql.Clear ;
sql.add('select * from baocun');
open;
Append;
FieldValues['名称']:=Edit2.text;
FieldValues['规格']:=Edit3.text;
post;
end;
end;
if cn<>1 then
begin
if ch=1 then
begin
with ADOQuery4 do
begin
close;
sql.Clear ;
sql.add('select * from baocun');
open;
Append;
FieldValues['名称']:=Edit2.text;
FieldValues['规格']:=Edit3.text;
post;
end;
end;
end;
Edit1.text:='' ;
Edit2.text:='';
Edit3.text:='';
Edit4.text:='';
Edit1.text:=IntToStr(form25.ADOQuery1.RecordCount+1);
end;
end
else
begin
ADOQuery1.Close;
AdOQuery1.SQL.Clear ;
ADOQuery1.SQL.Add('select * from jibenxinxi where 序号='''+xh+'''');
ADOQuery1.Open ;
ADOQuery1.Edit;
ADOQuery1.FieldByName('序号').AsString := Edit1.text;
ADOQuery1.FieldByName('名称').AsString := Edit2.text;
ADOQuery1.FieldByName('规格').AsString := Edit3.text;
ADOQuery1.FieldByName('数量').AsString := Edit4.text;
ADOquery1.Post ;
showmessage('清单记录修改成功!');
form25.Hide;
end;
end
else
begin
showmessage('对不起,您输入的数量不是数字,请重新输入!')
end;
ADOQuery3.Close;
ADOQuery3.SQL.Clear;
ADOQuery3.SQL.Add('select * from baocun');
ADOQuery3.Open;
ADOQuery3.sql.text:='select distinct 名称 from baocun where 名称 like'''+'%'+Edit2.Text+'%'+'''';
ADOQuery3.Open ;
ADOQuery3.first;
while not ADOQuery3.eof do
begin
ADoQuery3.next;
end;
end;
procedure TForm25.Button2Click(Sender: TObject);
begin
form25.Hide;
form2.Enabled:=true;
form2.Show;
end;