Z
zm790607
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.AddClass(AId: integer;FatherNode:TTreeNode);
var
QryTmp:TADOQuery;
myNode:TTreeNode;
myLabel:TLabel;
begin
QryTmp:=TADOQuery.Create(self);
QryTmp.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+extractfilepath(application.ExeName)+'test.mdb;Persist Security Info=False';
QryTmp.SQL.Add('select * from tb1');
QryTmp.SQL.Add('where FatherId='+inttostr(AId));
QryTmp.Open;
while not QryTmp.Eof do
begin
myNode:=Treeview1.Items.AddChild(FatherNode,QryTmp.fieldbyname('CName').AsString);
//创建标签,caption存放各分支的AutoId表识
myLabel:=TLabel.Create(self);
myLabel.Visible:=false;
myLabel.Caption:=QryTmp.fieldbyname('AutoId').AsString;
myNode.Data:=myLabel;
AddClass(QryTmp.fieldbyname('AutoId').AsInteger,myNode); //递归调用过程
QryTmp.Next;
end;
QryTmp.Free;
end;
把 QryTmp.fieldbyname('AutoId').AsInteger 换成 DataModule1.ADOQuery1.FieldValues['autoid'] 就出现bug 不知道是哪里的问题 ,
真郁闷啊 ,请高手 帮忙啊 指点一下啊 先谢谢啦
var
QryTmp:TADOQuery;
myNode:TTreeNode;
myLabel:TLabel;
begin
QryTmp:=TADOQuery.Create(self);
QryTmp.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+extractfilepath(application.ExeName)+'test.mdb;Persist Security Info=False';
QryTmp.SQL.Add('select * from tb1');
QryTmp.SQL.Add('where FatherId='+inttostr(AId));
QryTmp.Open;
while not QryTmp.Eof do
begin
myNode:=Treeview1.Items.AddChild(FatherNode,QryTmp.fieldbyname('CName').AsString);
//创建标签,caption存放各分支的AutoId表识
myLabel:=TLabel.Create(self);
myLabel.Visible:=false;
myLabel.Caption:=QryTmp.fieldbyname('AutoId').AsString;
myNode.Data:=myLabel;
AddClass(QryTmp.fieldbyname('AutoId').AsInteger,myNode); //递归调用过程
QryTmp.Next;
end;
QryTmp.Free;
end;
把 QryTmp.fieldbyname('AutoId').AsInteger 换成 DataModule1.ADOQuery1.FieldValues['autoid'] 就出现bug 不知道是哪里的问题 ,
真郁闷啊 ,请高手 帮忙啊 指点一下啊 先谢谢啦