eco中整表删除代码

来源:互联网 发布:西安软件开发培训班 编辑:程序博客网 时间:2024/06/16 09:55
从blog.org的我的原博客中迁入

发表时间:2006-11-24 16:31:45

此为正确的代码

var list1:ielementcollection;

begin

...

  list1 := ehfx.element.GetAsCollection;
  for I := List1.Count - 1 downto 0 do
  begin
    afx := fxbb(list1.item[i].asobject);
    if assigned(afx) then
      afx.AsIObject.Delete;
  end;

  fecospace.UpdateDatabase;
  DataBind;

不能用iobjectlist进行操作,原来代码如下不能正常操作

var list1:iobjectlist;

begin

...

  list1 := iobjectlist(ehfx.element.getascollection());

  for I := List1.Count - 1 downto 0 do
  begin
    afx := fxbb(list1[i]);
    if afx <> nil then

      afx.AsIObject.delete;
  end;
  fecospace.UpdateDatabase;

出现的结果是没有进行任何操作.

原创粉丝点击