title: ASP.NET SQL Server stored procedure return Message
body: <p>I have a stored procedure that does not require any parameters and the returns the value 0 and the messages:  </p>
  
  <pre><code>(94 row(s) affected)
  
  (1 row(s) affected)
  </code></pre>
  
  <p>My question is how do I get the messages:</p>
  
  <pre><code>(94 row(s) affected)
  
  (1 row(s) affected)
  </code></pre>
  
  <p>This is my .NET Method that calls the stored procedure:</p>
  
  <pre><code>public List&lt;MessageClass&gt; ChequesToUpdate()
  {
      message = new List&lt;MessageClass&gt;();
  
      MessageClass item = new MessageClass();
  
      try
      {
          using (connection = new SqlConnection(connectionString))
          {
              connection.Open();
  
              using (SqlCommand command = new SqlCommand("MyStoredProcedure", connection))
              {
                  command.CommandType = CommandType.StoredProcedure;
  
                  command.ExecuteNonQuery();
  
                  item.message = "message";
              }
          }
      }
      catch (Exception e)
      {
          item.message = e.Message;
      }
      finally
      {
          connection.Close();
      }
  
      message.Add(item);
  
      return message;
  }
  </code></pre>
  
  <p>I am looking to put the message in <code>item.message</code>, how would I accomplish this?</p>