I guess AgentRegisterNewUser
is a stored procedure, therefore the cmd.CommandType should be StoredProcedure
:
SqlCommand cmd = new SqlCommand("AgentRegisterNewUser", conn);
cmd.CommandType = CommandType.StoredProcedure;
w/o this change you are executing the T-SQL batch consisting of the text "AgentRegisterNewUser". This will compile to call the procedure, even w/o an exec, but will not pass any parameter since your params are passed to the batch.