S
su37su37
Unregistered / Unconfirmed
GUEST, unregistred user!
二级为供应商,三级为系列型号,但因为一些器件的系列型号相同,会造成系列型号重复显示,如何解决啊,我积分没了,不能给大家了,大家不要见怪啦
procedure TManagementForm.FormShow(Sender: TObject);
var List :Array[0..5] of TTreenode;
a:integer;
begin
filldata;
Treeview1.Items.Clear;
Treeview1.Items.Add(nil,'设备管理');
DataModuleUnit.ADOQuery2.Close;
DataModuleUnit.ADOQuery2.SQL.Clear ;
DataModuleUnit.ADOQuery2.SQL.Add('Select * From 供应商信息表') ;
DataModuleUnit.ADOQuery2.Open;
while not DataModuleUnit.ADOQuery2.EOF do
begin
list[0]:=treeview1.Items.AddChild(treeview1.Items[0],DataModuleUnit.ADOquery2.
fieldbyname('供应商').asstring);
list[0].SelectedIndex:=1 ;
list[0].ImageIndex:=1 ;
DataModuleUnit.Adoquery2.Next;
end;
DataModuleUnit.ADOQuery2.Close ;
DataModuleUnit.ADOQuery2.SQL.Clear ;
DataModuleUnit.ADOQuery2.SQL.Add('Select * From 器件信息表') ;
DataModuleUnit.ADOQuery2.open;
While not DataModuleUnit.AdoQuery2.EOF do
begin
For a:=0 to Treeview1.Items[0].Count-1 do
begin
if DataModuleUnit.AdoQuery2.fieldbyname('供应商').AsString=Treeview1.Items[0].
Item[a].Text then
begin
list[1]:=treeview1.Items.AddChild(treeview1.Items[0].Item[a],DataModuleUnit.Adoquery2.
fieldbyname('系列型号').asstring);
list[1].SelectedIndex:=2;
list[1].ImageIndex:=2;
end;
end;
DataModuleUnit.AdoQuery2.Next;
end;
DataModuleUnit.ADOQuery2.Close ;
DataModuleUnit.ADOQuery2.SQL.Clear ;
Treeview1.Items[0].Expanded:=True;
end;
procedure TManagementForm.FormShow(Sender: TObject);
var List :Array[0..5] of TTreenode;
a:integer;
begin
filldata;
Treeview1.Items.Clear;
Treeview1.Items.Add(nil,'设备管理');
DataModuleUnit.ADOQuery2.Close;
DataModuleUnit.ADOQuery2.SQL.Clear ;
DataModuleUnit.ADOQuery2.SQL.Add('Select * From 供应商信息表') ;
DataModuleUnit.ADOQuery2.Open;
while not DataModuleUnit.ADOQuery2.EOF do
begin
list[0]:=treeview1.Items.AddChild(treeview1.Items[0],DataModuleUnit.ADOquery2.
fieldbyname('供应商').asstring);
list[0].SelectedIndex:=1 ;
list[0].ImageIndex:=1 ;
DataModuleUnit.Adoquery2.Next;
end;
DataModuleUnit.ADOQuery2.Close ;
DataModuleUnit.ADOQuery2.SQL.Clear ;
DataModuleUnit.ADOQuery2.SQL.Add('Select * From 器件信息表') ;
DataModuleUnit.ADOQuery2.open;
While not DataModuleUnit.AdoQuery2.EOF do
begin
For a:=0 to Treeview1.Items[0].Count-1 do
begin
if DataModuleUnit.AdoQuery2.fieldbyname('供应商').AsString=Treeview1.Items[0].
Item[a].Text then
begin
list[1]:=treeview1.Items.AddChild(treeview1.Items[0].Item[a],DataModuleUnit.Adoquery2.
fieldbyname('系列型号').asstring);
list[1].SelectedIndex:=2;
list[1].ImageIndex:=2;
end;
end;
DataModuleUnit.AdoQuery2.Next;
end;
DataModuleUnit.ADOQuery2.Close ;
DataModuleUnit.ADOQuery2.SQL.Clear ;
Treeview1.Items[0].Expanded:=True;
end;