title: Run stored procedure in C#, pass parameters and capture the output result
body: <p>This is a simple task that I want to acheive but ASP.NET makes it quite difficult, next to impossible. I followed this question
  <a href="https://stackoverflow.com/questions/4124100/running-a-stored-procedure-in-c-button">Running a Stored Procedure in C# Button</a> but found out <code>ExecuteNonQuery</code> does not return the output from query.</p>
  
  <p>I tried this other approach but can't seem to pass the paremeters in this way</p>
  
  <pre><code>SqlConnection myConnection = new SqlConnection(myconnectionString);
  
  SqlCommand myCommand = new SqlCommand();
  myCommand.CommandType = CommandType.StoredProcedure;
  myCommand.CommandText = "usp_GetCustomer";
  
  myCommand.SelectParameter &lt;-- does not exist
  </code></pre>
  
  <p>Can someone write this simple code, how can I implement it? Basically I am passing a <code>@username</code> and <code>@month</code> (both character strings) to stored procedure and it returns a number that I want to capture and assign to a label control. </p>
  
  <p>Thank you</p>
  
  <p>The output from my query is this. It runs a complex query, create a temp table and then it runs </p>
  
  <pre><code>select @@rowcount
  </code></pre>
  
  <p>and I am capturing that.</p>