I keep getting the exception
The SqlParameterCollection only accepts non-null SqlParameter type objects, not String objects
, while execut
For any future readers of this question - the examples deal with .Add(), but .Remove() will also throw this error if not used correctly. The proper way to use .Add(), as has been documented by others is :
cmd.Parameters.AddWithValue("Key", "Value");
The proper way to use .Remove() is:
cmd.Parameters.Remove(command.Parameters["Key"]);