title: return value Auto Mode XML
body: <p>I am trying to dynamically write some xml for a webservice. I have recently been shown how to use the  FOR XML AUTO clause for my sql query, but I am not sure If one I am writing the query properly and on top of this I am not sure how to return the document values </p>
  
  <pre><code>using (SqlConnection oCn = new SqlConnection())
  {
      oCn.ConnectionString = @"server=sql-server\cos;integrated security=SSPI;database=daas5";
      oCn.Open();
  
      // Create a SQL command object.
      string strSQL = "SELECT * FROM dd615.musicdetails WHERE artistname LIKE '%" + 
                          searchTerm + "%' OR recordname LIKE '%" + searchTerm + "%' 
                          OR recordtype LIKE '%" + searchTerm + "%' 
                          OR format LIKE '%" + searchTerm + "%'
                       FOR XML AUTO, ELEMENTS, ROOT('musicInformation') ";
  
      SqlCommand myCommand = new SqlCommand(strSQL, oCn);
  }          
  </code></pre>
  
  <p>any help would be greatly appreciated </p>