title: Passing a parameter to an sql stored procedure in c#
body: <pre><code>        string commandGetIslemIdleri = ("EXEC GetIslemIdleri");
  
          cmd = new SqlCommand(commandGetIslemIdleri, sqlConn);
          cmd.Parameters.Add(new SqlParameter("@CARIID", 110));
  
          using (var reader = cmd.ExecuteReader()) //error occurs here
          {
              while (reader.Read())
              {
                  islemidleri.Add(reader.GetInt32(0));
  
              }
  
          }
  </code></pre>
  
  <p>Above is the code i am trying to write to call the below stored procedure with a parameter <code>CARIID</code> which is an integer. when i run the code an error occurs and says <code>"Procedure or function 'GetIslemIdleri' expects parameter '@CARIID', which was not supplied."</code>
  but as much as i understand from the examples i read from <a href="http://www.csharp-station.com/Tutorials/AdoDotNet/Lesson07.aspx" rel="noreferrer">here</a> i am sending the parameter with this code <code>cmd.Parameters.Add(new SqlParameter("@CARIID", 110));</code> i need help, thank you in advance.</p>
  
  <pre><code>ALTER PROCEDURE [dbo].[GetIslemIdleri] 
      @CARIID int 
  AS
  BEGIN
  SET NOCOUNT ON;
  
  SELECT ID
  FROM TBLP1ISLEM
  WHERE TBLP1ISLEM.CARI_ID=@CARIID
  END
  </code></pre>