最小值0最大值:ADOQuery.FieldCount - 1如: for i := 0 to ADOQuery.FieldCount - 1 do Info := Info + ADOQuery.Fields[i].FieldName + #10;
上楼的,不是求有多少个字段,是求这个字段值value的最大值
自己解决了,谢谢上楼 Data: array of Double; nColCount:=qryHistoryVol_group.FieldCount - 1; SetLength(Data, nColCount); for i:= 0 to nColCount-1 do begin Data[i]:=qryHistoryVol_group.Fields[i+1].Value; end; ShowMessage('×î´óÖµ='+FloatToStr(MaxValue(Data))+' ×îСֵ='+FloatToStr(MinValue(Data)));
哦,看错了~~~那就在循环中比较一下,取大的值即可;var i,j,iMax:integer;iMax :=1 for j :=2 to i do begin if (ADOQuery.Fields[j].integer>ADOQuery.Fields[iMax].integer) then iMax := j; endADOQuery.Fields[iMax].integer ...//这个就是最大的了
for i := 0 to ADOQuery.FieldCount - 1 do
Info := Info + ADOQuery.Fields[i].FieldName + #10;
Data: array of Double;
nColCount:=qryHistoryVol_group.FieldCount - 1;
SetLength(Data, nColCount);
for i:= 0 to nColCount-1 do
begin
Data[i]:=qryHistoryVol_group.Fields[i+1].Value;
end;
ShowMessage('×î´óÖµ='+FloatToStr(MaxValue(Data))+' ×îСֵ='+FloatToStr(MinValue(Data)));
i,j,iMax:integer;iMax :=1
for j :=2 to i do
begin
if (ADOQuery.Fields[j].integer>ADOQuery.Fields[iMax].integer) then
iMax := j;
endADOQuery.Fields[iMax].integer ...//这个就是最大的了