Simple question: I have a stored proc that has an output of @oRetVal.
I have it coded as such:
Code |
After I execute the proc I have:
Code |
But I am getting the error: "Specified cast is not valid"
I am not sure what the issue is. The variable is created as an int and the actual param is an int. What am I doing wrong here?
Thanks

PJ MartinsRank #2,548 · 548 reputationPosted Jun 5, 2010, 4:35 PM EDT
retVal = Convert.ToInt16(sql.Parameters["@oRetVal"].Value);
cbeebe796 reputationPosted Jun 5, 2010, 11:12 PM EDT
sql.Parameters["@oRetVal"].Direction = ParameterDirection.InputOutput
and it solved the problem. It's amazing that the simple problems are the ones that can slow you down the most, lol.
Regards