这样不行:  
 
with  adoquery2  do  
begin  
try  
close;  
sql.Clear;  
sql.Add('select  类别,名称,规格,品牌,车型,通用车型  from  进货');  
open;  
label37.Caption:=inttostr(recordcount);  
except  
label37.Caption:='0';  
end;
end;  
 
但这样却行:  
with  adoquery2  do  
begin  
try  
close;  
sql.Clear;  
sql.Add('select  *  from  进货');  
open;  
label37.Caption:=inttostr(recordcount);  
except  
label37.Caption:='0';  
end;  
end; 
 
为什么啊???  
真郁闷~!

解决方案 »

  1.   

    'select  类别,名称,规格,品牌,车型,通用车型  from  进货'
    ========你的字段名不正确吧
      

  2.   

    sql.Add('select  类别,名称,规格,品牌,车型,通用车型  from  进货');  //还有一种就是你的逗号要换成西文的逗号(,)而不能用中文的逗号(,)
      

  3.   

    你用的是什么数据库啊?是Access?
    你这样试试吧,也许 类别 在你的数据库中被当成了保留字/关键字sql.Add('select  [类别],名称,规格,品牌,车型,通用车型  from  进货');即:把类别用英文中括与括起来。