小弟在使用存储过程时出现了一个很奇怪的问题,在更新数据时只有两个字段更新了,其他的都没更新,没有任何提示错误,请高手赐教!谢谢大家!定义如下:
CREATE   proc proc_insertContent
@A_filename int,
@A_projectName varchar(255),
@A_explain text,
@A_ID int,
@A_projectType varchar(40)as
if exists (select * from Tbl_administrativeAllow where @A_filename=A_filename)
  begin
   update Tbl_administrativeAllow
   set A_explain=@A_explain,@A_projectName=A_projectName,@A_ID=A_ID,@A_projectType=A_projectType,A_renewTime=getdate()
   where (@A_filename=A_filename)
  end
GO执行如下:
exec proc_insertContent 1,'11','22',9,'aa'结果只有A_explain字段和A_renewTime被更新了,其他都没变,也没出现任何提示错误,这是怎么回事?

解决方案 »

  1.   

    A_explain=@A_explain,A_projectName=@A_projectName,A_ID=@A_ID,A_projectType=@A_projectType,A_renewTime=getdate()@写=后面
      

  2.   

    A_explain=@A_explain,A_projectName=@A_projectName,A_ID=@A_ID,A_projectType=@A_projectType,A_renewTime=getdate()
      

  3.   

    嗯,谢谢crazyflower()和junmail(浪子)! 果真是这样,不过不是说变量和字段的顺序可以变吗?我以前更新时并没用出错啊!
    还有一个问题,网站上是用asp
    sql="exec proc_insertContent "&id&",'"&A_projectName&"','"&A_explain&"',"&A_ID&",'"&A_projectType&"'"
    rs.open sql,conn,3,3去调用该存储过程的,但现在这些内容都在服务器上,而我现在又不能去服务器修改,请问我有什么方法可以直接能过网站发布界面实现正确的内容更新吗?
    我以前更新时并没用出错啊!
      

  4.   

    在网站里还有一个存储过程是用于添加信息的,定义如下:CREATE   proc proc_insertContent2
    @A_projectName varchar(255),
    @A_explain text,
    @A_ID int,
    @A_projectType varchar(40)as
    if exists (select * from Tbl_administrativeAllow where @A_projectName=A_projectName and @A_projectType=A_projectType)
      begin
       update Tbl_administrativeAllow
       set A_explain=@A_explain,A_renewTime=getdate()
       where (@A_projectName=A_projectName) and (@A_projectType=A_projectType)
      end
    else
      begin
       insert into Tbl_administrativeAllow
       (A_ID,A_projectType,A_explain,A_projectName,A_renewTime)
       values(@A_ID,@A_projectType,@A_explain,@A_projectName,getdate())
      end
    select A_filename from Tbl_administrativeAllow where (@A_projectName=A_projectName) and (@A_projectType=A_projectType)
    GO现在通过网站进行添加也添加不上,估计也是上述的原因吗?可是在我本机网站上却能添加,这是为什么?唉,别怪我笨啊!