Unable to unzip as int

Hi guys, I have this sql im parameter getting can not unbox as int error

returnValue = (int)cmdUpdateCreatedOn.Parameters["@intcount"].Value; 

the return value is declared as int returnValue = 0 and my parameter is also declared as int, and it updates the row of strings. I tried using a different conversion syntax that doesn't seem to work.

MY 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 
+4
source share
1 answer

I had the same problem.

The INT returned in the stored procedure is of type "SHORT". I do not know why.

Unable to execute ... "@SubjectID" ... (which has the actual type 'short') for 'string'.

Decision:
1. Cancel "SHORT" in C # OR
2. Use Convert.ToInt32 in C #.

+8
source

Source: https://habr.com/ru/post/1495348/


All Articles