C# System.FormatException';在mscorlib.dll中发生,但未在用户代码错误中处理

C# System.FormatException';在mscorlib.dll中发生,但未在用户代码错误中处理,c#,sql,.net,stored-procedures,C#,Sql,.net,Stored Procedures,这个问题在前面已经讨论过了,但这并不能帮助我解决问题 下面是使投资处于非活动状态的存储过程 ALTER procedure [dbo].[mark_inactive] @order_id int, @intResult int output as BEGIN transaction Declare @Error as in

这个问题在前面已经讨论过了,但这并不能帮助我解决问题

下面是使投资处于非活动状态的存储过程

ALTER  procedure [dbo].[mark_inactive]                  
@order_id int,                 
@intResult int output                  
as                  
BEGIN transaction               

Declare @Error as int

update investment_orders set investment_active = 0 where order_id = @order_id


-- if error in saving details                    
Select @Error = @@error                    
 if(@Error<>0)                    
 Begin                    
  Set @intResult = 0                    
  rollback transaction            
  return                      
 End          
commit transaction                    
return @intResult 
如果有任何错误,我很抱歉。请帮我解决这个问题


谢谢

您在成功更新后编写的存储过程中没有返回任何值

你的程序应该是这样的

ALTER  procedure [dbo].[mark_inactive]                  
@order_id int,                 
@intResult int output                  
as                  
BEGIN transaction               

Declare @Error as int

update investment_orders set investment_active = 0 where order_id = @order_id;
SET @intResult = 1; // 1 OR whatever desired value you wanna return

-- if error in saving details                    
Select @Error = @@error                    
 if(@Error<>0)                    
 Begin                    
  Set @intResult = 0                    
  rollback transaction            
  return                      
 End          
commit transaction                    
return @intResult 
ALTER过程[dbo]。[mark_inactive]
@订单号,
@intResult int输出
作为
开始交易
将@Error声明为int
更新投资\u订单设置投资\u活动=0,其中订单\u id=@order\u id;
设置@intResult=1;//1或任何想要返回的值
--如果保存详细信息时出错
选择@Error=@@Error
如果(@Error0)
开始
设置@intResult=0
回滚事务
返回
终点
提交事务
返回@intResult

错误发生在哪一行?ExecuteOnQuery或Int32.Parse?谢谢您的回复。Int32.Parse section returning error在尝试解析之前,我会先检查out参数的内容并确保它有值。@bangla Tiger-我很高兴它能工作!!请将其标记为有帮助的答案,以便对其他人也有帮助!!:)-我是新来的,不知道如何将它标记为有用。你能告诉我吗?
Input string was not in a correct format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.FormatException: Input string was not in a correct format.    
ALTER  procedure [dbo].[mark_inactive]                  
@order_id int,                 
@intResult int output                  
as                  
BEGIN transaction               

Declare @Error as int

update investment_orders set investment_active = 0 where order_id = @order_id;
SET @intResult = 1; // 1 OR whatever desired value you wanna return

-- if error in saving details                    
Select @Error = @@error                    
 if(@Error<>0)                    
 Begin                    
  Set @intResult = 0                    
  rollback transaction            
  return                      
 End          
commit transaction                    
return @intResult