linq to xml 的多表查询
时间:2011-04-20 来源:xuebingz
var query2 = from f in doc_US_Fundamentals_xml.Descendants("上市公司")
join t in doc_US_Technicalxml.Descendants("上市公司")
on f.Attribute("代码").Value equals t.Attribute("代码").Value
where f.Attribute("代码").Value.Equals(code)
select new
{
yMinPrice = t.Attribute("年最高价").Value,//52周最低价
yMaxPrice = t.Attribute("年最高价").Value,//52周最高价
marketPRate = f.Attribute("市盈率").Value,
PershareDividend = f.Attribute("每股派息").Value,
ShiZhi = Convert.ToDouble(f.Attribute("股份数").Value) * Convert.ToDouble(close), //市值(股份数*股票的股价)
ctockCount = f.Attribute("股份数").Value//总股本
s };