title: converting xml document to data table in C#
body: <p>I'm trying to read a simple webservice (REST) and populate a drop down box in my C# desktop application. I;m using .net 2.0</p>
  
  <p>Following is my web service return xml</p>
  
  <pre><code>&lt;sections type="array"&gt;
   &lt;section&gt;
    &lt;name&gt;Standing&lt;/name&gt;
    &lt;created-at type="datetime"&gt;2011-10-23T23:17:54+05:30&lt;/created-at&gt;
    &lt;updated-at type="datetime"&gt;2011-10-23T23:17:54+05:30&lt;/updated-at&gt;
    &lt;id type="integer"&gt;1&lt;/id&gt;
    &lt;status type="integer"&gt;1&lt;/status&gt;
    &lt;service-charge type="float"&gt;0.0&lt;/service-charge&gt;
   &lt;/section&gt;
   &lt;section&gt;
    &lt;name&gt;VIP&lt;/name&gt;
    &lt;created-at type="datetime"&gt;2011-10-30T11:27:05+05:30&lt;/created-at&gt;
    &lt;updated-at type="datetime"&gt;2011-10-30T11:27:05+05:30&lt;/updated-at&gt;
    &lt;id type="integer"&gt;2&lt;/id&gt;
    &lt;status type="integer"&gt;1&lt;/status&gt;
    &lt;service-charge type="float"&gt;10.0&lt;/service-charge&gt;
   &lt;/section&gt;
  </code></pre>
  
  <p></p>
  
  <p>and in the following code I'm trying to convert the xml document to a data table</p>
  
  <pre><code>  public DataTable getSections() {
      String url = "http://&lt;site_url&gt;/sections.xml";
      DataTable t = new DataTable();
      HttpHandler handle = new HttpHandler();
      StreamReader sr = handle.executeGET(url);
      String xml = "";
      while (sr.Peek() &gt;= 0)
      {
          xml  += sr.ReadLine();
      }
      XmlDataDocument doc = new XmlDataDocument();
      doc.LoadXml(xml);
      XmlReader xmlReader = new XmlNodeReader(doc);
      DataSet ds = new DataSet();
      ds.ReadXml(xmlReader);
      t = ds.Tables[0];
      return t;
  }
  </code></pre>
  
  <p>and in the last segment I'm trying to bind it to my drop down box (cmbSections)</p>
  
  <pre><code>DataTable t = sec.getSections();
  cmbSections.DataSource = t;
  cmbSections.DisplayMember = "name";
  cmbSections.ValueMember = "id";
  </code></pre>
  
  <p>But I'm getting the following error</p>
  
  <pre><code>Cannot bind to the new display member.
  Parameter name: newDisplayMember
  </code></pre>
  
  <p>What am i missing here, please help, I'm new to C# world</p>