现在的问题是:第一,我不明白什么什么时候会导致,error>0第二,当产品的库存不够的时候,我想让他返回一个数值 也就是 
if @pro_newcount >1                           
update ys_shop set counts=@pro_newcount 
where ys_name=@pro_names                             
else 
return(2)但是,只要我一加上
else 
return(2)
如果库存不够的话  就不对,提示错!
Microsoft OLE DB Provider for ODBC Drivers 错误 '80004005' [Microsoft][ODBC SQL Server Driver][SQL Server]EXECUTE 后的事务计数指出缺少了 COMMIT 或 ROLLBACK TRANSACTION 语句。原计数 = 0,当前计数 = 1。 /shop_ys/sendfriend.asp,行29 第三:还有一种情况就是,如果再我的订单表中有一个产品号,而我不小心删除了,此时,找不到该产品,此时,出现的情况,应该是会导致那种错误的产生呢!

解决方案 »

  1.   

    @@error 是针对上条sql语句的,也就是说
    你只针对
    update loogoo_order set isend=1 where id=@o_id
    看看有没有错误!
      

  2.   

    那我如果是库存的数量减去订单上产品的数量小于等于0的时候,返回一个数值可以么
    就是这句
    if @pro_newcount >0                           
    update ys_shop set counts=@pro_newcount 
    where ys_name=@pro_names                             
    else 
    return(2)
    事务中、如果出现意外的话,可以返回值么
      

  3.   

    出现意外的话,可以返回值
    你把 需要的返回参数定义成output