核心提示:procedure CreateSubTree(FNodeName: string; Node: TTreeNode = nil);varmLocalName: string;TreeNode: TT...
procedure CreateSubTree(FNodeName: string; Node: TTreeNode = nil);
var
mLocalName: string;
TreeNode: TTreeNode;
Ads_Tmp: TADODataSet;
begin
ADS_Tmp := TADODataSet.Create(Self);
ADS_Tmp.Connection := ADOConn;
with ADS_Tmp do
begin
Close;
CommandText := 'Select * from Type Where ParentID =' + FNodeName;
Open;
First;
while not Eof do
begin
mLocalName := FieldbyName('ID').Asstring;
TreeNode := TreeView.Items.AddChild(Node, FieldByName('Name').AsString);
CreateSubTree(mLocalName, TreeNode);
Next;
end;
end;
end;