var 
  strArray:array of string;
nCount:integer;
begin
   query1.sql.clear;
   query1.sql.add('select * from TBL');
   nCount:=query1.纪录;
   query.open;
 SetLength(type_name, query.recoardcount-1, query.fields.count-1);
  for i:=0 to query.recoardcount-1 do
  begin
    for j:=0 to query.fields.count-1 do
    begin
        strArray[i,j]:=qyery1.items.Field[j];
    end;
  end; end;

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);
    const
      AStr = 'The %s is of the %s category and its length is %f in.';
    var
      VarArr: Variant;
      F: Double;
    begin
      VarArr := VarArrayCreate([0, 2], varVariant);
      VarArr := Table1['Common_Name;Category;Length_In'];
      F := VarArr[2];
      ShowMessage(Format(AStr, [VarArr[0], VarArr[1], F]));
    end;
      

  2.   

    for i:=0 to query.recoardcount-1 do
      begin
        for j:=0 to query.fields.count-1 do
        begin
            strArray[i,j]:=qyery1.Field[j];《---------------
        end;
      query.next;《-----------------
      end;
      

  3.   

    var
      Type_Name: array of array of string;
      I, J: Integer;
    begin
     Query1.close;
     Query1.SQL.Text := 'select * from tableA where 條件';
     Query1.Open;
     SetLength(Type_Name, Query1.RecordCount, Query1.Fields.Count);
     for I := 0 to Query1.RecordCount - 1 do begin
       Query1.RecNo := I;
       for J := 0 to Query1.Fields.Count - 1 do
         Type_Name[I, J] := Query1.Fields[J].AsString;
     end;
    end;//其实用一个变体数组可以搞定!
    //你想作啥?
    //请你参考
    http://kingron.myetang.com/zsfunc04.htm
      

  4.   

    dreamfan(dreamfan)的办法解决了问题,怎么给分呀?