The type or namespace name 'MilkDetails' could not be found (are you missing a using directive or an assembly reference?)
From your codes I guess that your MilkDetails is a class of entity or something like that,So plz make sure that it really defined or you've referred it into your own proj by referring its namespace at the top of your current codes。I suspect that
you should change from "MilkDetails" to "MilkDetail"——
List<MilkDetail> MilkDetail = new List<MilkDetail>();
From your given xml contents,I'd prefer to read it like using LINQ-TO-XML(suppose you have a class called "MilkDetail" with the public properties whose names are the same as what they are defined in the xml file……):
var result = from e in XDocument.Load("xx.xml").Descedants("MilkDetails")
select new MilkDetail
{
InvoiceDate = e.Element("InvoiceDate").Value,
AmountInLitres = e.Element("AmountInLitres").Value,
……………………
};
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Is this possible
Apr 18, 2012 01:04 AM|LINK
Hello Cheiftain:)
From your codes I guess that your MilkDetails is a class of entity or something like that,So plz make sure that it really defined or you've referred it into your own proj by referring its namespace at the top of your current codes。I suspect that you should change from "MilkDetails" to "MilkDetail"——
From your given xml contents,I'd prefer to read it like using LINQ-TO-XML(suppose you have a class called "MilkDetail" with the public properties whose names are the same as what they are defined in the xml file……):
var result = from e in XDocument.Load("xx.xml").Descedants("MilkDetails") select new MilkDetail { InvoiceDate = e.Element("InvoiceDate").Value, AmountInLitres = e.Element("AmountInLitres").Value, …………………… };