procedure TFrmSetPurview.ReadAllFunc(trvFunc:TfcTreeView); var qryTemp1,qryTemp2:Tquery; trnTemp,trnTemp1:TfcTreeNode; begin //读取所有功能 qryTemp1:=TQuery.Create(nil); qryTemp2:=TQuery.Create(nil); with qryTemp1 do begin //设置主功能 DatabaseName:='sdzx'; qryTemp2.databaseName:='sdzx'; SQl.text:='select * from t_workfunction where substring(f_funcid,3,2)='+#39+'00'+#39; Open; while not eof do begin trnTemp:=trvFunc.Items.Add(nil,Fieldbyname('f_funcname').AsString+'.'+Fieldbyname('f_funcid').AsString); qryTemp2.Close; qryTemp2.SQL.Text:='select f_funcid,f_funcname from t_workfunction ' +'where substring(f_funcid,1,2)='+#39+copy(Fieldbyname('f_funcid').AsString,1,2)+#39+' ' +'and substring(f_funcid,3,2)<>'+#39+'00'+#39; qryTemp2.Open; while not qryTemp2.Eof do begin trnTemp1:=trvFunc.Items.AddChild(trnTemp,qryTemp2.Fieldbyname('f_funcname').AsString+'.'+qryTemp2.Fieldbyname('f_funcid').AsString); trnTemp1.CheckboxType:=tvctCheckbox; qryTemp2.Next; end; qryTemp2.Close; Next; end; end; end;
var
qryTemp1,qryTemp2:Tquery;
trnTemp,trnTemp1:TfcTreeNode;
begin
//读取所有功能
qryTemp1:=TQuery.Create(nil);
qryTemp2:=TQuery.Create(nil); with qryTemp1 do
begin //设置主功能
DatabaseName:='sdzx';
qryTemp2.databaseName:='sdzx';
SQl.text:='select * from t_workfunction where substring(f_funcid,3,2)='+#39+'00'+#39;
Open;
while not eof do
begin
trnTemp:=trvFunc.Items.Add(nil,Fieldbyname('f_funcname').AsString+'.'+Fieldbyname('f_funcid').AsString);
qryTemp2.Close;
qryTemp2.SQL.Text:='select f_funcid,f_funcname from t_workfunction '
+'where substring(f_funcid,1,2)='+#39+copy(Fieldbyname('f_funcid').AsString,1,2)+#39+' '
+'and substring(f_funcid,3,2)<>'+#39+'00'+#39;
qryTemp2.Open;
while not qryTemp2.Eof do
begin
trnTemp1:=trvFunc.Items.AddChild(trnTemp,qryTemp2.Fieldbyname('f_funcname').AsString+'.'+qryTemp2.Fieldbyname('f_funcid').AsString);
trnTemp1.CheckboxType:=tvctCheckbox;
qryTemp2.Next;
end;
qryTemp2.Close;
Next;
end;
end;
end;
http://expert.csdn.net/Expert/topic/1726/1726330.xml?temp=.5689661
http://expert.csdn.net/Expert/topic/1848/1848541.xml?temp=.9955408
http://expert.csdn.net/Expert/topic/1848/1848739.xml?temp=.8219721以上纯属偶然?