就是我把要查询地字段名,放在一个tstringlist中现在要根据里面地字段名,来生成sql语句

解决方案 »

  1.   

    //没什么技术因素,写一个就行了function CreateSQLString(ATableName:string;AStringList:TStringList):string;
    var
      i:integer;
    begin
      Result:='';
      if (not Assigned(AStringList))or(AStringList.Count<=0) then Exit;
      for i:=0 to AStringList.Count-1 do
      begin
        if i<>0 then Result:=Result+',';
        Result:=Result+AStringList.Strings[i];
      end;
      Result:='SELECT '+Result+' FROM'+ATableName;
    end;