Read data from XML file, Bind dataset and row filter on dataview

Use namespace using System.Xml;
 

In this code you can see how to bind the xml to a dataset. Then convert that dataset into dataview. You can use rowfilter if required.

  XmlTextReader xmlreader = new XmlTextReader(Server.MapPath("uploads/geofence.xml"));

        DataSet dsgeo = new DataSet();

        dsgeo.ReadXml(xmlreader);

        xmlreader.Close();

        if (dsgeo.Tables.Count != 0)
        {
            DataView dv = dsgeo.Tables[0].DefaultView;
            dv.RowFilter = "CountyName='" + geoCounty + "'";
          string value= dv[0]["latlng"].ToString();
    

        }

Related Alrticles

FREE!!! Registration