Here we have an example for creating xml result from a data base using LINQ.
How to get Even or Odd or last 'N' Number of records in SQL Server.
Query to write LINQ :
XElement elements=new XElement("Customers",
(from m in Customers
select m).ToList().Select(m=>new XElement("Customer",
new XAttribute("CompanyName",m.CompanyName),
new XAttribute("ContactName",m.ContactName))));
Console.WriteLine(elements);
Output :
No comments:
Post a Comment