H
hongshanwdj
Unregistered / Unconfirmed
GUEST, unregistred user!
我是初学者。各位大侠帮小弟看看下面的查询,速度太慢啊---当数据量很大时,帮小弟改改,谢谢拉 <br> treeview1.Items.Clear;<br> treeview1.Items.Add(nil,'数据浏览');<br> query2.Close;<br> query2.SQL.Clear;<br> query2.SQL.Add('select Distinct nianyue from sysdb');<br> query2.Open;<br> While not query2.eof do<br> begin<br> Tlist:=treeview1.Items.AddChild(treeview1.Items[0],query2.fieldbyname('nianyue').asstring);<br> tlist.selectedindex:=1;<br> tlist.ImageIndex:=0;<br> query2.Next;<br> end;<br> query2.Close;<br> query2.SQL.Clear;<br> query2.SQL.Add('select * from sysdb');<br> query2.Open;<br>aaa: while not query2.Eof do<br> begin<br> for a:=0 to treeview1.items[0].count -1 do<br> if query2.FieldByName('nianyue').AsString=treeview1.Items[0].Item[a].Text then<br> begin<br> if bianhao<>query2.fieldbyname('bianhao').asstring then<br> begin<br> tlist:=treeview1.Items.AddChild(treeview1.Items[0].item[a],query2.fieldbyname('bianhao').AsString <br> tlist.SelectedIndex:=2;<br> tlist.ImageIndex:=1;<br> bianhao:=query2.fieldbyname('bianhao').asstring;<br> end;<br> if bianhao=query2.fieldbyname('bianhao').asstring then<br> begin<br> bianhao:=query2.fieldbyname('bianhao').asstring;<br> query2.Next;<br> goto aaa;<br> end;<br> end;<br> query2.Next;<br> end;