to sachow:
  问题是我要对数组赋值,如下:
for i:=0 to clientdataset1.fieldscount-1 do
copyarray[i]:=clientdataset1.fields.fields[i].vulue;
如果不设定长度,则在COPY 是会出现非法操作

解决方案 »

  1.   

    to:Sachow(有助) 
        不同意你的观点.作为参数的动态数组不是不用设长度(你怎么直到别人不用),而是不能设长度.
      

  2.   

    我上次的方法是在implementation  后用 var 设了一个动态数组.
    劝你也这么干吧.
      

  3.   

    你所用的是DELPHI的什么版本?
    DELPHI3以下不支持动态数组!
      

  4.   

    var procedure TForm1.Button1Click(Sender: TObject);//test ok
     var S:variant;iCount:Integer; 
     begin
       iCount:=Self.Table1.Fields.Count;
       S:=VarArrayCreate([0,iCount-1],varVariant);
       for iCount:=0 to Self.Table1.fields.Count-1 do
        S[iCount]:=Self.Table1.Fields[iCount].Value;end;
      

  5.   

    谢谢lwm8246 和 xzisgood ,我知道该怎么做了。分数马上给上