1

OK、Ado DB テーブル名は [pass] フィールドです。

[id]
[Machine]
[Level]
[Username]
[Password]

このようにツリービューですべてのレコードを表示したい

[Machine]
--|Level|
----Username
----Password
--|Level|
----username
----Password
[Machine]
--|Level|
----username
----Password

など..

データベースに接続する方法は知っていますが、データをツリーにインポートしてノードまたはサブレベル アイテムとして宣言する方法がわかりません。

ありがとうグレン

現在のコード。

procedure TForm2.Button1Click(Sender: TObject);
var
  Qry:TADOQuery;
  selected : string;
  i:integer;
begin
    Qry:=TADOquery.Create(Self);
    try
       qry.Connection := dbconnection;
       qry.SQL.Clear;
       qry.SQL.Add('Select * FROM [Pass]');
       qry.Open;
       Qry.First;
       i:=1;
       with qry do
       begin
           while qry.RecordCount >= i do
           begin

           end;
       end;
    finally
        Qry.Active:=False;
        Qry.Free;
    end;

end;
4

1 に答える 1

1

これは良い出発点だと思います。アプリケーションで 2 つのテーブルをロードするために使用します。

procedure TdlgTestsSections.LoadSections;
var
  AllSectionsNode, SectionNode, SubSectionNode, AllParamsNode,
  i: Integer;
begin
  tvSections.Items.Clear;
  AllSectionsNode := tvSections.Items.AddNode(nil, nil, 'All Sections',
    Pointer(0), naAddFirst);
  dmLabData.qTestSections.Requery;
  while not dmLabData.qTestSections.Eof do
  begin
    SectionNode := tvSections.Items.AddNode(nil, AllSectionsNode,
      dmLabData.qTestSectionsName.Value,
      Pointer(dmLabData.qTestSectionsID.Value), naAddChild);
    dmLabData.qTestSubSections.First;
    while not dmLabData.qTestSubSections.Eof do
    begin
      SubSectionNode := tvSections.Items.AddNode(nil, SectionNode,
        dmLabData.qTestSubSectionsName.Value,
        Pointer(dmLabData.qTestSubSectionsRowNo.Value), naAddChild);
      SubSectionNode.Expanded := False;
      dmLabData.qTestSubSections.Next;
    end;
    dmLabData.qTestSections.Next;
  end;
end;
于 2012-08-30T06:37:41.840 に答える