for i := 0 to strList.Count - 1 do
begin
root := trevMain.Items.AddChild(nil,strList.Strings[i]);
DM.SmartQuery_1.Close;
DM.SmartQuery_1.SQL.Clear;
DM.SmartQuery_1.SQL.Add('***');
DM.SmartQuery_1.Open;
DM.SmartQuery_1 .First; if DM.SmartQuery_1.RecordCount = 0 then
Exit;
repeat
nodTemp := trevMain.Items.AddChild(root, DM.SmartQuery_MX.FieldByName('name').AsString); DM.SmartQuery3.Session := DM.OraSession_1;
DM.SmartQuery3.Close;
DM.SmartQuery3.SQL.Clear;
DM.SmartQuery3.SQL.Add('***');
DM.SmartQuery3.Open;
DM.SmartQuery3.First;
repeat
nodTemp1 := trevMain.Items.AddChild(nodTemp, DM.SmartQuery3.FieldByName('name').AsString); DM.SmartQuery.Session := DM.OraSession_1;
DM.SmartQuery.Close;
DM.SmartQuery.SQL.Clear;
DM.SmartQuery.SQL.Add('***');
DM.SmartQuery.Open;
DM.SmartQuery.First;
repeat
trevMain.Items.AddChild(nodTemp1, DM.SmartQuery.FieldByName('name').AsString +
'-' + DM.SmartQuery.FieldByName('code').AsString);
DM.SmartQuery.Next;
until
DM.SmartQuery.Eof; DM.SmartQuery3.Next;
until
DM.SmartQuery3.Eof; DM.SmartQuery_1.Next;
until
DM.SmartQuery_1.Eof;
end;
DM.SmartQuery_MX.Close;
begin
root := trevMain.Items.AddChild(nil,strList.Strings[i]);
DM.SmartQuery_1.Close;
DM.SmartQuery_1.SQL.Clear;
DM.SmartQuery_1.SQL.Add('***');
DM.SmartQuery_1.Open;
DM.SmartQuery_1 .First; if DM.SmartQuery_1.RecordCount = 0 then
Exit;
repeat
nodTemp := trevMain.Items.AddChild(root, DM.SmartQuery_MX.FieldByName('name').AsString); DM.SmartQuery3.Session := DM.OraSession_1;
DM.SmartQuery3.Close;
DM.SmartQuery3.SQL.Clear;
DM.SmartQuery3.SQL.Add('***');
DM.SmartQuery3.Open;
DM.SmartQuery3.First;
repeat
nodTemp1 := trevMain.Items.AddChild(nodTemp, DM.SmartQuery3.FieldByName('name').AsString); DM.SmartQuery.Session := DM.OraSession_1;
DM.SmartQuery.Close;
DM.SmartQuery.SQL.Clear;
DM.SmartQuery.SQL.Add('***');
DM.SmartQuery.Open;
DM.SmartQuery.First;
repeat
trevMain.Items.AddChild(nodTemp1, DM.SmartQuery.FieldByName('name').AsString +
'-' + DM.SmartQuery.FieldByName('code').AsString);
DM.SmartQuery.Next;
until
DM.SmartQuery.Eof; DM.SmartQuery3.Next;
until
DM.SmartQuery3.Eof; DM.SmartQuery_1.Next;
until
DM.SmartQuery_1.Eof;
end;
DM.SmartQuery_MX.Close;
解决方案 »
- delphi的ListView控件如何判断当勾选checkbox时,选的是第几行?
- 如何用代码获得当前窗本的name和caption
- 现在做一个程序界面的美化工作,大家帮忙介绍一些方法
- Delphi 分析网页获取IP段
- 杭州的朋友请进
- delet键有两个,小键盘上的del键的ANSCII码是#46,那另一个哪?onkeypress能不能捕捉?在线急等
- 使用BDE Administrator创建一个 Paradox 数据库别名demo,具体怎么操作呀。
- 我想取得某个主键下的全部键值,然后赋给一个ListBox,请指点一下方向啊
- 那里有图标库下载???(*.ico,delphi工具栏,菜单栏图标)
- 哪里可以下载Turbo C 2.0?
- 问一个很菜的问题 别笑!
- 关于IPEdit,怎么去运用xxx.xxx.xxx.xxx四个字段?
dataset.filter:='id=***';
dataset.filtered:=true;
if DM.SmartQuery_1.RecordCount = 0 then //这句换成 if DM.SmartQuery_1.eof then不知你的查询语句是什么样子的,如果有条件,建议用绑定参数的方式,看你的代码是用的odac连的oracle,
在oracle数据库中用绑定参数比不用要快许多,因为减少了解析次数.
另:根据你的SQL建立索引,合理的索引能提高很多.
var
List:TStringList;
Node:TTreeNode;
Index:integer;
i:integer;
begin
TreeView.Items.BeginUpdate;
try
TreeView.Items.Clear; List:= TStringList.Create;
try
List.Sorted:= True;
cdsTree.First;
while not cdsTree.Eof do
begin
//如果是顶接点
if cdsTree.FieldByName('TopID').AsInteger= 0 then
begin
Node:=TreeView.Items.AddChild(nil, cdsTree.FieldByName(FName).AsString)
end else
begin
Index:= List.IndexOf(cdsTree.FieldByName('TopID').AsString);
Node:= TreeView.Items.AddChildFirst(TTreeNode(List.Objects[index]),
cdsTree.FieldByName(FName).AsString);
end;
List.AddObject(cdsTree.FieldByName('ID').AsString, Node);
cdsTree.Next;
end;
finally
List.Free;
cdsTree.Close;
end;
finally
TreeView.Items.EndUpdate;
end;
给你个通用的方法,根据你自己的情况修改
with oraquery1 do
begin
close;
sql.text := ' select username,sex,password,deptno from users where userno=:userno';
parambyname('userno').value := '001';
open;
end;
类似这样的.