无
无头骑士
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.CreateTree(var ANode: TTreeNode; var pid: integer);
var
id: integer;
sname: string;
bmk: TBookMark;
begin
with ADOQuery1 do
begin
filter := 'pid=' + IntToStr(pid);
while not ADOQuery1.EOF do
begin
if ADOQuery1.RecNo<>0 then //.FieldByName('名称').AsString <> null then
begin
sname := FieldByName('名称').AsString;
Anode := Treeview1.Items.AddChild(Anode, sname);
id := FieldByName('ID').AsInteger;
bmk := GetBookmark;
CreateTree(ANode, id);
end
else
begin
Anode := Anode.Parent;
filter := 'pid=' + IntToStr(pid);
if ADOQuery1.BookmarkValid(bmk) then
begin
GotoBookmark(bmk);
FreeBookmark(bmk);
end;
end;
Next;
end;
end;
end;
var
id: integer;
sname: string;
bmk: TBookMark;
begin
with ADOQuery1 do
begin
filter := 'pid=' + IntToStr(pid);
while not ADOQuery1.EOF do
begin
if ADOQuery1.RecNo<>0 then //.FieldByName('名称').AsString <> null then
begin
sname := FieldByName('名称').AsString;
Anode := Treeview1.Items.AddChild(Anode, sname);
id := FieldByName('ID').AsInteger;
bmk := GetBookmark;
CreateTree(ANode, id);
end
else
begin
Anode := Anode.Parent;
filter := 'pid=' + IntToStr(pid);
if ADOQuery1.BookmarkValid(bmk) then
begin
GotoBookmark(bmk);
FreeBookmark(bmk);
end;
end;
Next;
end;
end;
end;