TSQLQuery1.frist;
Reapet
if TSQLQuery1.filedbyname('出生').asstring = '97' then
SUM := SUM + 1; //SUM为一个变量,作为计数器使用,初植为0
TSQLQuery1.Next;
until TSQLQuery1.eof
TSQLQuery1.frist;
AdoQuery1.sql.add(selet * from Tab_Name where bone ='1997';
AdoQuery1.open;
nCount:=AdoQuery1.RecordCount;
或者如果表已经打开:
AdoTable1.first;
nCount:=0;
while AdoTable1.eof do
begin
if AdoTable1.FieldByName('bone').AsString='1997' then
nCount:=nCount+1;
AdoTable1.next;
end;