title: Returning value from Stored Procedure and using it in C#
body: <p>I have created a function "Recover(string UserEmail)" that takes in the user's email for when he/she forgets their login information. This function runs a stored procedure called "Recover_PassWord", which I would like it to return the Username and Password so I can send an email to user. I am not too familiar with the syntax for creating a simple stored procedure that returns this information. I am also not too familiar with storing the returned value in C# so i can make use of it.<br><br>
  Recover_PassWord:<br></p>
  
  <pre><code>   CREATE DEFINER=`root`@`localhost` PROCEDURE `Recover_Password`(IN Email CHAR(40))
  BEGIN
    SELECT UserName,PassWord FROM  userdata
    WHERE Email=ContactEmail;
   END
  </code></pre>
  
  <p>Recover(String UserEmail):<br></p>
  
  <pre><code> public ActionResult Recover(string UserEmail)
      {
          Login model = new Login();
          MySqlConnection connect = DbConnection();
          MySqlCommand cmd = new MySqlCommand("Recover_PassWord",connect);
          cmd.CommandType = CommandType.StoredProcedure;
          cmd.Parameters.AddWithValue("@Email", UserEmail);
          MySqlDataReader rd = cmd.ExecuteReader();
          while (rd.Read())
          {
              if (UserEmail == rd["ContactEmail"].ToString())
              {
                  MailMessage msg = new MailMessage();
                  msg.To.Add(UserEmail);
                  msg.Subject = "Recovered Login Information";
                  msg.Body = "Hello," + Environment.NewLine + "Your Login Information: "; //this is where i want to be able to use the returned value
              }
          }
          return null;
      }
  </code></pre>
  
  <p>Anyone have any recommendations and advice on how i can achieve this?</p>