我用一个TTreeView控件来显示数据库里的表记录,这里有个公用函数是用来添加TTreeView里的树状结构,
procedure TQuotationForm.AddTreeView;
var
  StrSQL,StrSQL1,StrSQL2 : String;
  Temp,ChildTemp : TTreeNode;
  StrQuotation,StrLabour,StrPart : String;
begin
  with MainForm.MainADOQU1 do
  begin
    StrSQL := 'select * from quotation ';    with MainForm.MainADOQU1 do
    begin
      Close;
      SQL.Text := StrSQL;
      Open;      if not Eof then
      begin  
        QuotationTV.Items.Clear;        First;        while not Eof do
        begin
          StrQuotation := FieldByName('quota_id').AsString;//这里是quotation表里记录ID值          Temp := QuotationTV.Items.Add(Nil,StrQuotation);//给TTreeview加显示记录          if OperateQuotation<>'' then //OperateQuotation是公用变量,不为空时就想让相对的记录项在TTreeView里变为被选择了的状态
            begin
              if StrQuotation=OperateQuotation then
                 begin
                   //应该怎么写呢?是QuotationTV.Items.Selected:=enable?但运行结果是错的
                   //我是这方面的新手,不知道怎么让quotation表中ID值与OperateQuotation变量相等的显示项变成已被选择,有哪位高手能帮一下我?谢谢
                 end;
            end;先谢谢大家了!