L
lsyx
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure Tfmlsy.addButton1Click(Sender: TObject);
begin
if Table1.RecordCount>0
then begin
Edit1.Text:=IntToStr(Table1.RecordCount+1);
Table1.Append; ????????
end
else Edit1.Text:='1';
end;
procedure Tfmlsy.SpeedButton6Click(Sender: TObject);
begin
if haschecked
then begin
Table1.Edit;
try
Table1.FieldByName('xh').Value:=StrToInt(Edit1.Text);
if Edit2.Text<>''
then Table1.FieldByName('mlmc').AsString:=Edit2.Text;
if Edit3.Text<>''
then Table1.FieldByName('yh').AsString:=Edit3.Text;
if Edit4.Text<>''
then Table1.FieldByName('bz').AsString:=Edit4.Text;
Table1.Post;
except
MessageDlg('未能修改成功',mtError,[mbok],0);
end;
Table1.Refresh;
end //if
else MessageDLg('输入错误,请重新输入',mtError,[mbok],0);
为什么有时不能增添新记录,而是修改了最后操作过的记录?
注:Delphi5+Access97
begin
if Table1.RecordCount>0
then begin
Edit1.Text:=IntToStr(Table1.RecordCount+1);
Table1.Append; ????????
end
else Edit1.Text:='1';
end;
procedure Tfmlsy.SpeedButton6Click(Sender: TObject);
begin
if haschecked
then begin
Table1.Edit;
try
Table1.FieldByName('xh').Value:=StrToInt(Edit1.Text);
if Edit2.Text<>''
then Table1.FieldByName('mlmc').AsString:=Edit2.Text;
if Edit3.Text<>''
then Table1.FieldByName('yh').AsString:=Edit3.Text;
if Edit4.Text<>''
then Table1.FieldByName('bz').AsString:=Edit4.Text;
Table1.Post;
except
MessageDlg('未能修改成功',mtError,[mbok],0);
end;
Table1.Refresh;
end //if
else MessageDLg('输入错误,请重新输入',mtError,[mbok],0);
为什么有时不能增添新记录,而是修改了最后操作过的记录?
注:Delphi5+Access97