if @textbox1!='' and @textbox2!='' begin set @where = @where +' and WTPROD between '''+@textbox1+''' and '''+@textbox2+'''' set @where2 = @where2 +' and x.WTPROD between '''+@textbox1+''' and '''+@textbox2+'''' end if @textbox3!='' and @textbox4!='' begin set @where = @where +' and WTTOOL between '''+@textbox3+''' and '''+@textbox4+'''' set @where2 = @where2 +' and x.WTTOOL between '''+@textbox3+''' and '''+@textbox4+'''' end 貌似没有用begin...end来包括语句块
if @textbox1!='' and @textbox2!=''
begin
set @where = @where +' and WTPROD between '''+@textbox1+''' and '''+@textbox2+''''
set @where2 = @where2 +' and x.WTPROD between '''+@textbox1+''' and '''+@textbox2+''''
end
if @textbox3!='' and @textbox4!=''
begin
set @where = @where +' and WTTOOL between '''+@textbox3+''' and '''+@textbox4+''''
set @where2 = @where2 +' and x.WTTOOL between '''+@textbox3+''' and '''+@textbox4+''''
end
貌似没有用begin...end来包括语句块
set nocount on