i need to find the Flight number whose price is minimum .How to go about this
query to find minimum node value in xml
i have an xml in below formathttp://schemas.xmlsoap.org/soap/envelope/">
http://www.w3.org/2001/XMLSchema-instance">
AF
Frankfurt
02:53 PM
Denver
02:09 PM
13628
124.8
LH
Frankfurt
11:17 AM
Denver
10:33 AM
13634
123.2
BA
Frankfurt
08:53 AM
Denver
08:09 AM
14021
109.2
i need to find the Flight number whose price is minimum .How to go about this
i need to find the Flight number whose price is minimum .How to go about this
Jignesh TrivediPosted May 14, 2013, 4:49 AM
hi,
assign value in xml string variable @runtime in below code.
try...
DataSet ds = new DataSet();
string xml = @"
";
ds.ReadXml(new XmlTextReader(new StringReader(xml)));
//ds.ReadXml(@"E:\test\testProject\testProject\testProject\XMLFile1.xml");
var price = (from d in ds.Tables["Flight"].AsEnumerable()
select d["Price"]).Min();
var flightNo = (from d in ds.Tables["Flight"].AsEnumerable()
where d["Price"] == price
select d["FlightNumber"]);
hope this will help you.
khalid tahaPosted May 14, 2013, 5:00 AM
khalid tahaPosted May 14, 2013, 4:13 AM
Jignesh TrivediPosted May 14, 2013, 3:58 AM
try
DataSet ds = new DataSet();
ds.ReadXml(@"E:\test\testProject\testProject\testProject\XMLFile1.xml");
var price = (from d in ds.Tables["Flight"].AsEnumerable()
select d["Price"]).Min();
var flightNo =(from d in ds.Tables["Flight"].AsEnumerable()
where d["Price"] == price
select d["FlightNumber"]);
hope this will help you.