title: Entity Framework .Net 6 with SQL Server stored procedure – parameter not supplied
body: <p>This is my first attempt at using EF to call a SQL Server stored procedure passing in parameters. This is an update stored procedure that I'm testing, and I keep getting an error</p>
  <blockquote>
  <p>Procedure or function 'Employee_Update' expects parameter '@EmployeeId', which was not supplied</p>
  </blockquote>
  <p>If I put a breakpoint in the code where it's calling the stored procedure, I can see the parameters and that they are populated properly. I've also copied and pasted the parameter names between the stored procedure and my code to make sure I didn't misspell something.</p>
  <p>Everything I've read about and see in the code suggests that it should work. I've also confirmed the stored procedure code is good by executing the stored procedure directly from SQL Server Management Studio, it works just fine.</p>
  <p>Anyone have a suggestion on what I can try or see something that looks like it wouldn’t work?</p>
  <pre><code>List&lt;SqlParameter&gt; sqlParms = new List&lt;SqlParameter&gt;
      {
          new SqlParameter { ParameterName = &quot;@EmployeeId&quot;, Value = employee.EmployeeID },
          new SqlParameter { ParameterName = &quot;@FirstName &quot;, Value = employee.FirstName },
          new SqlParameter { ParameterName = &quot;@LastName&quot;, Value = employee.LastName},
          new SqlParameter { ParameterName = &quot;@MiddleInitial&quot;, Value = employee.MiddleName }
      };
  db.Database.ExecuteSqlRaw(&quot;EXEC dbo.Employee_Update&quot;, sqlParms.ToArray());
  </code></pre>
  <p><em><strong>Update</strong></em></p>
  <p>Stored Proc Parameters</p>
  <pre><code>ALTER PROCEDURE [dbo].[Employee_Update]
  (
      @EmployeeId varchar(8),
      @FirstName varchar(40),
      @LastName varchar(40),
      @MiddleInitial char(1)
  )
  </code></pre>
  <p><a href="https://i.stack.imgur.com/lFwX9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lFwX9.png" alt="enter image description here" /></a></p>