print @sql 看看是什么,然后执行他

解决方案 »

  1.   


    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来包括语句块
      

  2.   

    用begin...end来包括语句块。就行了。
      

  3.   

    用print可以算是调试的好方法
      

  4.   

    在存储过程加上set nocount no
      

  5.   

    刚打错了,应该是
    set nocount on