title: Reading returned xml from stored procedure C#
body: <p>Hi I got a hard time reading XML returned from a stored procedure I get the XML I want from executing the procedure on the SQL server</p>
  
  <p>My stored procedure:</p>
  
  <pre><code>CREATE PROCEDURE [dbo].[GetUser]  
      @Username nvarchar(50)  
  AS
  
  select( SELECT * FROM "User" 
  WHERE "User".Username = @Username   
  FOR XML AUTO, ELEMENTS, ROOT('Users')) AS result
  </code></pre>
  
  <p>And my c# code here:</p>
  
  <pre><code>using (var conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ConString"].ConnectionString))
  using (SqlCommand cmd = new SqlCommand("[GetUser]", conn))
  {
       cmd.Parameters.AddWithValue("@Username", Username);
       cmd.CommandType = System.Data.CommandType.StoredProcedure;
       conn.Open();
       XmlReader reader = cmd.ExecuteXmlReader();
  }
  </code></pre>
  
  <p>The reader keeps getting the value of "none" what are my doing wrong please help
  I just want the XML as a String</p>
  
  <p>Hope you can help </p>
  
  <p>Thanks</p>