还有就是谁能给我一个比较简单的方法实现树状结构(数据来自数据库)
数据表
a     b      c
1     1      01
1     1      02
1     2      03
1     2      04
2     1      05
2     2      06
最终实现     1
        1 
           01
           02
        2
           03
           04
     2
        1
           05
        2
           06        最好是比较简单的方式,太复杂,小弟比较苯,学不会,
谢谢!!!

解决方案 »

  1.   

    function myFormat(I:integer;n:integer):String;
    begin
      Result:= StringReplace(Format('%*d',[n,I]),' ','0',[rfReplaceAll]);
    end;
      

  2.   

    自已写个函数不就行了
    2、动态建立,先建第一层a,然后据所选再建b,再据所选建c
    此时要用sql查出对应的子节点需要的数据
      

  3.   

    function NumToStr(Num: Integer; Len: Integer): string;
    { Len: 0 的个数 }
    var
      i: Integer;
      FmtStr: string;
    begin
      FmtStr := '%' + IntToStr(Len) + 'd';
      Result := Format(FmtStr, [Num]);
      for i := 1 to Length(Result) do
        if Result[i] = ' ' then Result[i] := '0';
    end;
    例子:Form1.Caption := NumToStr(1, 4);
      

  4.   

    StringOfChar('0', 4 - Length(IntToStr(10))) + IntToStr(10)
      

  5.   

    Format('%.05d', [value]) 对