I have an strange behavior in a web application that started happening this week. Even when it worked before I cannot retrieve InputOutput parameters from Sql Server anymore. Syntax in nearly all procedures is the same, I need to retrieve Identity values from tables to continue the process.
SqlParameter paramId = new SqlParameter("@Id", objMyValueId);
paramId.Direction = ParameterDirection.InputOutput;
After executing the SP with ExecuteNonQuery I always get null values (or any value set in InputOutput parameter).
paramId.Value --> (Always null)
It's like collection remains still and it can't be modified. Is there any setting in Sql Server or configuration parameter into a connection string that could affect this behavior? It happens in every stored procedure I execute and it worked before.
objMyValueIdshouldn't that be a DBType of some sortint, varchar, etc..?also show more of your code and I would look up using Parameter.AddWithValue` method vs using SqlParameter also where are you adding theSqlParameteryou should look at thisSOposting for a good example on what to do stackoverflow.com/questions/8148815/…AddWithValue.