陈
陈晨
Unregistered / Unconfirmed
GUEST, unregistred user!
数据库结构
rid, id, lid
rid,lid分别为
id的左右儿子
要求建立一个树形结构
id
|--lid
|--rid
procedure addno(pnode:ttreenode;ADO:Tadotable);
var psib,sib:ttreenode;
st:integer;
id:string;
lid,rid:string;
str,str1:string;
begin
psib:=pnode;
//st:=pos('...',psib.Text);
//if st>0 then begin
STR1:=psib.text;
// id:=copy(STR1,st+3,10);
if ado.Locate('id',str1,[]) then
begin
showmessage(inttostr(adotable1.recno));
begin
if ado.fieldvalues['rid']<>null then begin
str:=ado.FieldValues['rid'];//ado.FieldValues['name']+'...'+
adotable1.Locate('id',str1,[]);
sib:=treeview1.Items.AddChild(psib,str);
addno(sib,adotable1);
end;
if ado.fieldvalues['lid']<>null then begin
str:=ado.FieldValues['lid']; // ado.FieldValues['name']+'...'+
adotable1.Locate('id',str1,[]);
sib:=treeview1.Items.AddChild(psib,str);
addno(sib,adotable1);
end;
end;
end;
end;
在线等待
rid, id, lid
rid,lid分别为
id的左右儿子
要求建立一个树形结构
id
|--lid
|--rid
procedure addno(pnode:ttreenode;ADO:Tadotable);
var psib,sib:ttreenode;
st:integer;
id:string;
lid,rid:string;
str,str1:string;
begin
psib:=pnode;
//st:=pos('...',psib.Text);
//if st>0 then begin
STR1:=psib.text;
// id:=copy(STR1,st+3,10);
if ado.Locate('id',str1,[]) then
begin
showmessage(inttostr(adotable1.recno));
begin
if ado.fieldvalues['rid']<>null then begin
str:=ado.FieldValues['rid'];//ado.FieldValues['name']+'...'+
adotable1.Locate('id',str1,[]);
sib:=treeview1.Items.AddChild(psib,str);
addno(sib,adotable1);
end;
if ado.fieldvalues['lid']<>null then begin
str:=ado.FieldValues['lid']; // ado.FieldValues['name']+'...'+
adotable1.Locate('id',str1,[]);
sib:=treeview1.Items.AddChild(psib,str);
addno(sib,adotable1);
end;
end;
end;
end;
在线等待