Clearing out and re-populating ListBox - InfoPath Dev
in

InfoPath Dev

Clearing out and re-populating ListBox

Last post 06-26-2015 06:10 AM by SearchKnowledge. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 06-26-2015 06:10 AM

    Clearing out and re-populating ListBox

    I have an infopath form: myFields (Group) field2 (Field (element)) //this is a ListBox The ListBox is auto populated from a DataSource and the "Entries" in the properties window is: "/dfs:myFields/dfs:dataFields/d:row" I am querying the SQL database: try { myConnection.Open(); SqlDataReader sdr = null; string strQuery = @""; //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("/my:myFields/my:field2", this.NamespaceManager); string strNS = node.NamespaceURI; foreach (DataRow row in ds.Tables[0].Rows) { using (XmlWriter xw = node.AppendChild()) { xw.WriteStartElement("myFields", strNS); xw.WriteElementString("field2", strNS, row["CourseTime"].ToString()); //"CourseTime" 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.
    Filed under:
Page 1 of 1 (1 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.