<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Browser Forms</title><link>https://www.infopathdev.com:443/forums/40.aspx</link><description>For browser form specific questions</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Clearing out and re-populating ListBox</title><link>https://www.infopathdev.com:443/forums/thread/102984.aspx</link><pubDate>Fri, 26 Jun 2015 13:10:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:102984</guid><dc:creator>SearchKnowledge</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/102984.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=40&amp;PostID=102984</wfw:commentRss><description>I have an infopath form:

     myFields (Group)
          field2 (Field (element)) //this is a ListBox

The ListBox is auto populated from a DataSource and the &amp;quot;Entries&amp;quot; in the properties window is: &amp;quot;/dfs:myFields/dfs:dataFields/d:row&amp;quot;

I am querying the SQL database:

try
{
    myConnection.Open();
    SqlDataReader sdr = null;
    string strQuery = @&amp;quot;&amp;quot;; //query the sql table to get some data...


    SqlDataAdapter sda = new SqlDataAdapter(strQuery, myConnection);

    DataSet ds = new DataSet();
    sda.Fill(ds);



    XPathNavigator node = navigator.SelectSingleNode(&amp;quot;/my:myFields/my:field2&amp;quot;, this.NamespaceManager);

    string strNS = node.NamespaceURI;

    foreach (DataRow row in ds.Tables[0].Rows)
    {
        using (XmlWriter xw = node.AppendChild())
        {
            xw.WriteStartElement(&amp;quot;myFields&amp;quot;, strNS);
            xw.WriteElementString(&amp;quot;field2&amp;quot;, strNS, row[&amp;quot;CourseTime&amp;quot;].ToString()); //&amp;quot;CourseTime&amp;quot; is the column in the query
            xw.WriteEndElement();
            xw.Flush();
            xw.Close(); //ERROR: Schema validation found non-data type errors.
        }
    }
}

How do I resolve the ERROR above? I am looking to clear out the entries for the ListBox and re-populate with the DataSet.</description></item></channel></rss>