if (table1.Eof) then begin showmessage('测试结束'); dbgrid1.Visible:=true; table1.Close; table2.Open; table2.edit;//add table2.AppendRecord([hno,hname,hsex,hold,hphone,inttostr(j),inttostr(i),strtodate(hdate)]); table2.Post; table2.Close; EXIT; end;
table的CachedUpdate属性要改为:true; if (table1.Eof) then begin showmessage('测试结束'); dbgrid1.Visible:=true; table2.Close;(注:table1要改为table2) table2.Open; table2.edit; table2.AppendRecord([hno,hname,hsex,hold,hphone,inttostr(j),inttostr(i),strtodate(hdate)]); table2.Post; table2.Close; EXIT; end;
with table2 do begin edit; AppendRecord(... ... end
begin
showmessage('测试结束');
dbgrid1.Visible:=true;
table1.Close;
table2.Open;
table2.edit;//add
table2.AppendRecord([hno,hname,hsex,hold,hphone,inttostr(j),inttostr(i),strtodate(hdate)]);
table2.Post;
table2.Close;
EXIT;
end;
if (table1.Eof) then
begin
showmessage('测试结束');
dbgrid1.Visible:=true;
table2.Close;(注:table1要改为table2)
table2.Open;
table2.edit;
table2.AppendRecord([hno,hname,hsex,hold,hphone,inttostr(j),inttostr(i),strtodate(hdate)]);
table2.Post;
table2.Close;
EXIT;
end;
begin
edit;
AppendRecord(...
...
end
处于编辑状态
所以先TABLE2.EDIT
===================================================================
暗恋女司机,薪水全做公交车了!
http://www.csdn.net/expert/topic/926/926315.xml?temp=4.807681E-02