Tstrings必须自己create;而且必须用子类实例化
begin
  currentfields:=tstringslist.create;
  query.........
end;

解决方案 »

  1.   

    winAPI说得对。
    另外别忘了最后要把它free掉。currentfields.free();
      

  2.   

    TStrings是一个基类,不能有实例,你可以用它的派生类TStringList产生实例,
    就是说TStrings是专门让人扩充用的,你也可派生它;
      

  3.   

    var
    currentfields:Tstrings;begin
        currentfields:=tstringlist.create;
        query1.GetFieldNames(currentfields);//这行???
        currentfields.free;
    end;
      

  4.   

    多谢大家,但我还是不明白,为什么不是用 currentfields:=tstrings.create
    而是用 currentfields:=tstringlist.create ?currentfields 是 tstring 啊
      

  5.   

    tstrings是一个抽象类。抽象类不能实例化的。
      

  6.   

    var  StringList: TStrings;
    begin  StringList := TStringList.Create;
      try
        with StringList do begin
          Add('This example uses A string List.');
          Add('It is the easiest way to add strings');
          Add('to a combobox''s list of strings.');
          Add('Always remember TStrings.Create method');
          Add('is abstract; So use TStringList.Create');
          Add('method instead.');    end;    with ComboBox1 do begin      Width := 210;
          Items.Assign(StringList);
          ItemIndex := 0;
        end;
      finally
        StringList.free;
      end;
    end;