无法取消装箱作为Int

CSh*_*per 4 c# parameters unboxing

嘿伙计们,我有这个sql参数我得到了不能作为int错误的unbox

returnValue = (int)cmdUpdateCreatedOn.Parameters["@intcount"].Value;
Run Code Online (Sandbox Code Playgroud)

返回值声明为int returnValue = 0,我的参数也声明为int,它正在更新行的行数.我尝试过不同的转换语法似乎没有用.

我的SP是

ALTER Procedure [dbo].[UpdateStation]
@intcount int output AS 
select StationaryName into #stname from Stationaries where Authorized = 0 
select * from #stname 
Update Stationaries Set  Authorized = 1 where Authorized = 0 set @intcount =   @@rowcount
Run Code Online (Sandbox Code Playgroud)

pka*_*thk 8

我遇到过同样的问题.

在存储过程中返回的INT是"SHORT"类型.我不知道为什么.

无法将"@ SubjectID"...(其实际类型为"short")转换为"string".

解决方案:
1.在c#OR中将"Unbox"设置为"SHORT"
2.在c#中使用Convert.ToInt32.