bdpcommand1.commandtext:='select count(*) as a from table1';<br>count:=bdpcommand1.executnonquery;//返回的是0或-1<br>如果是下面的方法<br>readinfo:=bdpcommand1.executreader;<br>count:=readinfo.getint32(1);//运行程序时出错
问题已解决<br>bdpcommand1.commandtext:='select count(*) as a from table1';<br>readinfo:=bdpcommand1.executreader;<br>count:=readinfo.getint32(0);//count的数值就是返回的行数,之前没有注意第一列是从0开始的<br><br>再次感谢大家的帮助