If IsNothing(command.Parameters("@UserId")) thrown an exception why?
command is a sqlcommand and i need to test the parameters collection before to add the @userid parameter so i use:
If IsNothing(command.Parameters("@UserId")) and i get this exception:
+ ex {"An SqlParameter with ParameterName'@UserId' is not contained by this SqlParameterCollection."} System.Exception

