با کد زیر مشکلم حل شد.function cat_tree(showall: boolean = false; root: integer = 0 ; prefix: string = ''): string;
var
wher,title,str : string;
data1 : array of array of string;
i,j:integer;
begin
if(root=0) then wher:= ' parent= ' + IntToStr(root)
else wher :='parent=' + IntToStr(root) + ' and parent<>id ';
with Data.AQL_Temp1 do
begin
Close;
SQL.Clear;
SQL.Add('select * from group where ' + wher + ' order by title');
Open;
end;
Data.AQL_Temp1.First;
if (Data.AQL_Temp1.RecordCount>0) then
begin
setlength(data1,Data.AQL_Temp1.RecordCount,3);
for i := 0 to ((Data.AQL_Temp1.RecordCount)-1) do
begin
data1[i,0]:=VarToStr(Data.AQL_Temp1['id']);
data1[i,1]:=VarToStr(DataAQL_Temp1['parent']);
data1[i,2]:=VarToStr(Data.AQL_Temp1['title']);
Data.AQL_Temp1.Next;
end;
end;
j:=0;
while j<>i do
begin
if prefix='' then str:='' else str:=prefix + '>';
title:=str + VarToStr(data1[j,2]);
Combo.Items.Add(title);
cat_tree(showall, StrToInt(data1[j,0]), title);
j:=j+1;
end;
end;
با تشکر
علاقه مندي ها (Bookmarks)