W
wxm337766
Unregistered / Unconfirmed
GUEST, unregistred user!
delphi ADO+access 怎样找到指定条记录?
procedure TAIMeasure.GetAvg();
var
ADO:TADOQuery;
i:integer;
Sum,Avg:real;
begin
try
ADO:=TADOQuery.create(self);
ADO.Connection:=Datamodule1.ADOConnection1;
ADO.close;
ADo.sql.clear;
ADO.sql.add('select ch0 from Save'); /////////////明天用升序ASC试一试!~
ADpen;
ADO.First;
for i:=1 to ADO.RecordCount do
begin
Sum:=Sum+strtofloat(ADO.Fields.AsString);//这里
end;
Avg:=Sum/ADO.RecordCount;
edit51.Text:=floattostr(Avg);
finally
ADO.free;
end;
procedure TAIMeasure.GetAvg();
var
ADO:TADOQuery;
i:integer;
Sum,Avg:real;
begin
try
ADO:=TADOQuery.create(self);
ADO.Connection:=Datamodule1.ADOConnection1;
ADO.close;
ADo.sql.clear;
ADO.sql.add('select ch0 from Save'); /////////////明天用升序ASC试一试!~
ADpen;
ADO.First;
for i:=1 to ADO.RecordCount do
begin
Sum:=Sum+strtofloat(ADO.Fields.AsString);//这里
end;
Avg:=Sum/ADO.RecordCount;
edit51.Text:=floattostr(Avg);
finally
ADO.free;
end;