procedure ColorSet(area : TAdvStringGrid; Lev : string; iCount : integer);
var
  str : String;
  qry : TADOQuery;
  ACol, ARow : integer;
begin
  qry := TADOQuery.Create(nil);
  qry.Connection := TDB.Create(nil).CON;   /////////////这里出错!!!!
  str := 'select position,count(barcode) as bCount from stock  ' +
         'where position  ' +
         'like :Lev +''%'' group by position having count(barcode) + :iCount < 4';
进来的朋友,先谢了~