title: Too many arguments specified
body: <p>I'm working on an application which allows one to list movies as well edit, insert and delete them. In the db I have three tables (Movie, Genre and MovieGenre) and this problem is related to adding a genre to a movie (by adding to the table MovieGenre, which keeps tracks of the movies genres).</p>
  
  <p>Below is the relevant code, as well as the thrown exception. I just can't figure out why I get this error message, because I use the right number of arguments as I can see it in the c# code when calling the sproc.</p>
  
  <p>Can somebody see what's the problem here?</p>
  
  <p><strong>Exception:</strong>
  Procedure or function usp_InsertMovieGenre has too many arguments specified.</p>
  
  <p><strong>Exception Details:</strong> System.Data.SqlClient.SqlException: Procedure or function usp_InsertMovieGenre has too many arguments specified.</p>
  
  <p><strong>c# code:</strong></p>
  
  <pre><code>public void InsertMovieGenre(MovieGenre movieGenre) {
  
      using (SqlConnection conn = CreateConnection()) {
          try {
              SqlCommand cmd = new SqlCommand("dbo.usp_InsertMovieGenre", conn);
              cmd.CommandType = CommandType.StoredProcedure;
  
              cmd.Parameters.Add("@MovieID", SqlDbType.Int, 4).Value = movieGenre.MovieID;
              cmd.Parameters.Add("@GenreID", SqlDbType.Int, 4).Value = movieGenre.MovieGenreID;
  
              cmd.Parameters.Add("@MovieGenreID", SqlDbType.Int, 4).Direction = ParameterDirection.Output;
  
              conn.Open();
  
              cmd.ExecuteNonQuery();
  
              movieGenre.MovieID = (int)cmd.Parameters["@MovieGenreID"].Value;
          }
          catch {
          }
      }
  }
  </code></pre>
  
  <p><strong>sproc:</strong></p>
  
  <pre><code>ALTER PROCEDURE usp_InsertMovieGenre
  @GenreID varchar(500),
  @MovieID int
  AS
  BEGIN
      INSERT INTO MovieGenre (GenreID, MovieID)
      VALUES (@GenreID, @MovieID);
  END
  GO
  </code></pre>