在dataset中使用xpath查询,进行distinct结果集
操作代码如下:
XmlDataDocument xmlDoc = new XmlDataDocument(dataSet);
XmlNodeList nodeList = xmlDoc.DocumentElement.SelectNodes(@"//Table");
SelectNodes(里面如何写xpath表达式) ?
效果如此sql一样:select distinct employeeid from Table
解决方案:
XmlNodeList nodeList = xmlDoc.DocumentElement.SelectNodes(@"//Table/EmployeeID[not(.=preceding::*/EmployeeID)]")
XmlNodeList nodeList = xmlDoc.DocumentElement.SelectNodes(@"//Table");
SelectNodes(里面如何写xpath表达式) ?
效果如此sql一样:select distinct employeeid from Table
解决方案:
XmlNodeList nodeList = xmlDoc.DocumentElement.SelectNodes(@"//Table/EmployeeID[not(.=preceding::*/EmployeeID)]")