title: Getting a Return Value in C# asp.net from a stored procedure (syntax issue)
body: <p>I am having issues trying to get the syntax correct for my C# 2008 asp.net code.
  I need to get a return value (Select @@Identity) from my stored procedure</p>
  
  <p>My C# code is:</p>
  
  <pre><code>        SqlConnection conn = new SqlConnection(strConn);
          string sql = "usp_ClientProfile_Header";
          SqlCommand cmdHeader = new SqlCommand(sql, conn);
  
          cmdHeader.CommandType = CommandType.StoredProcedure;
  
          cmdHeader.Parameters.Add(new SqlParameter("@FirstName", SqlDbType.VarChar, 50));
          cmdHeader.Parameters["@FName"].Value = txtFName.Text.Trim();
  
          cmdHeader.Parameters.Add(new SqlParameter("@LastName", SqlDbType.VarChar, 50));
          cmdHeader.Parameters["@LName"].Value = txtLName.Text.Trim();
  
          cmdHeader.Parameters.Add(new SqlParameter("@EmailAddress", SqlDbType.VarChar, 100));
          cmdHeader.Parameters["@Email"].Value = txtEMail.Text.Trim();
  
          cmdHeader.Parameters.Add(new SqlParameter("@Address1", SqlDbType.VarChar, 255));
          cmdHeader.Parameters["@Address1"].Value = txtAddress1.Text.Trim();
  
          cmdHeader.Parameters.Add(new SqlParameter("@City", SqlDbType.VarChar, 50));
          cmdHeader.Parameters["@City"].Value = txtCity.Text.Trim();
  
          cmdHeader.Parameters.Add(new SqlParameter("@State", SqlDbType.VarChar, 50));
          cmdHeader.Parameters["@State"].Value = txtState.Text.Trim();
  
          cmdHeader.Parameters.Add(new SqlParameter("@ZipCode", SqlDbType.VarChar, 12));
          cmdHeader.Parameters["@Postal_Code"].Value = txtZip.Text.Trim();
  </code></pre>
  
  <p>The next line in my code needs to be the "<em>ParameterDirection.ReturnValue</em>" but I can't seem to get the syntax correct.</p>
  
  <p>Any ideas?</p>