本帖最后由 lhf66729351 于 2009-09-25 17:16:29 编辑

解决方案 »

  1.   

    不会吧  错误170:第三行 “max”附近语法错误
       必须声明变量@News_ID
       必须声明变量@News_content
      

  2.   

    @News_content varchar(max) =null,
      

  3.   


    --将nvarchar(max) 改为: varchar(max)
      

  4.   

    CREATE PROCEDURE [dbo].[getNews] 
    @News_subject nvarchar(1000) =null, 
    @News_content nvarchar(1000) =null, 
    @type int, 
    @FileName varchar(255) =null, 
    @descriptions nvarchar(1000) =null, 
    @News_sources nvarchar(1000) =null, 
    @News_clicks int, 
    @News_author nvarchar(1000) =null, 
    @News_addtime datetime, 
    @show int, 
    @Thumbnail varchar(255) =null, 
    @width int, 
    @height int, 
    @titleColor varchar(255) =null, 
    @keywords nvarchar(1000) =null, 
    @News_ID int 
    AS 
    set nocount on 
    begin 
    If @News_ID is Null Return 
    Select @News_subject=News_subject,@News_content=News_content,@type=type,@FileName=Filename,@descriptions=description,@News_sources=News_Sources,@News_clicks=News_clicks,@News_author=News_author,@News_addtime=News_addtime,@show=show,@Thumbnail=Thumbnail,@width=width,@height=height,@titleColor=titleColor,@keywords=keywords From News where @News_ID=News_ID 
      return 
        end 
        go 
      

  5.   

     这个也不对 我原来是这么写的 可是不好使 报错误 Text类型不对  用convert转换
      

  6.   

    那就用nvarchar(4000)nvarchar(4000)=nvarchar(MAX)
      

  7.   

    是啊Nvarchar(4000)=Nvarchar(Max) 一样都是错误的
      

  8.   

    ALTER PROCEDURE [dbo].[getNews] 
    @News_subject nvarchar(1000) =null, 
    @News_content nvarchar(max) =null, 
    @type int, 
    @FileName varchar(255) =null, 
    @descriptions nvarchar(1000) =null, 
    @News_sources nvarchar(1000) =null, 
    @News_clicks int, 
    @News_author nvarchar(1000) =null, 
    @News_addtime datetime, 
    @show int, 
    @Thumbnail varchar(255) =null, 
    @width int, 
    @height int, 
    @titleColor varchar(255) =null, 
    @keywords nvarchar(1000) =null, 
    @News_ID int 
    AS 
    set nocount on begin If (ISNULL(@News_ID,'')<>'')
    Select @News_subject=News_subject,
       @News_content=News_content,
       @type=type,
       @FileName=Filename,
       @descriptions=description,
       @News_sources=News_Sources,
       @News_clicks=News_clicks,
       @News_author=News_author,
       @News_addtime=News_addtime,
       @show=show,
       @Thumbnail=Thumbnail,
       @width=width,@height=height,
       @titleColor=titleColor,
       @keywords=keywords 
          From News
         where News_ID = @News_ID;
    ELSE
      Select '对不起输入参数News_ID不能为空' '出错'
     
    END--如果还不对的话:你先看你定义的变量跟原表中相应字段的类型是不是一样!
    --或者把原表中相应字段的类型贴出来给我看看!
      

  9.   

    ALTER PROCEDURE [dbo].[getNews] 
    @News_subject nvarchar(1000) =null, 
    @News_content nvarchar(max) =null, 
    @type int, 
    @FileName varchar(255) =null, 
    @descriptions nvarchar(1000) =null, 
    @News_sources nvarchar(1000) =null, 
    @News_clicks int, 
    @News_author nvarchar(1000) =null, 
    @News_addtime datetime, 
    @show int, 
    @Thumbnail varchar(255) =null, 
    @width int, 
    @height int, 
    @titleColor varchar(255) =null, 
    @keywords nvarchar(1000) =null, 
    @News_ID int 
    AS 
    set nocount on begin If (ISNULL(@News_ID,0)<>0)
    Select @News_subject=News_subject,
       @News_content=News_content,
       @type=type,
       @FileName=Filename,
       @descriptions=description,
       @News_sources=News_Sources,
       @News_clicks=News_clicks,
       @News_author=News_author,
       @News_addtime=News_addtime,
       @show=show,
       @Thumbnail=Thumbnail,
       @width=width,@height=height,
       @titleColor=titleColor,
       @keywords=keywords 
          From News
         where News_ID = @News_ID;
    ELSE
      Select '对不起输入参数News_ID不能为空' '出错'
     
    END
      

  10.   

    是不是 数据库中不能含有text类型 当中news_content是text 
      

  11.   

    @News_content=convert(nvarchar(4000),News_content)  试一下,
      

  12.   

    啊  哈成了 谢谢bancxc  也同样谢谢luoyoumou1202