主要是这儿错了:
if @city=''
begin
SET @strSql='SELECT TOP ' + CAST(@pagesize as varchar) + ' a.id,a.cname FROM Allenterprise As a,newSheng As n WHERE left(a.area,3)=a.shengid And n.sheng=@sheng And a.show=1 AND a.ID not in (
             SELECT TOP ' + CAST((@page-1) * @pagesize AS varchar) + ' a.ID FROM Allenterprise As a WHERE a.show=1 'order by id'
end
else
begin
SET @strSql='SELECT TOP ' + CAST(@pagesize as varchar) + ' a.id,a.cname FROM Allenterprise As a,newCity As n WHERE a.area=a.cityid And n.city=@city And a.show=1 AND a.ID not in (
             SELECT TOP ' + CAST((@page-1) * @pagesize AS varchar) + ' a.ID FROM Allenterprise As a WHERE a.show=1 'order by id'
end