Looks like as written, your code is instructing SQL Server to just try executing this:
up_RemoveAssetOwnershipFromTeam
In other words, just the procedure with no parameters supplied.
To wire up the parameters you need to either specify CommandType.StoredProcedure, or wire up the command parameters explicitly:
// option 1
private static void EndOwnershipForTeam(long assetId, int teamId)
{
const string storedProcedureName = @"up_RemoveAssetOwnershipFromTeam";
using (var connection = new SqlConnection("context connection=true"))
using (var command = new SqlCommand(storedProcedureName, connection))
{
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("assetId", assetId);
command.Parameters.AddWithValue("teamId", teamId);
connection.Open();
command.ExecuteNonQuery();
}
}
// option 2
private static void EndOwnershipForTeam(long assetId, int teamId)
{
const string sql = @"exec up_RemoveAssetOwnershipFromTeam @assetId, @teamId";
using (var connection = new SqlConnection("context connection=true"))
using (var command = new SqlCommand(sql, connection))
{
command.Parameters.AddWithValue("@assetId", assetId);
command.Parameters.AddWithValue("@teamId", teamId);
connection.Open();
command.ExecuteNonQuery();
}
}