Data Table Distinct XElement

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
hello experts can u hell me get an xml which will return distinct rows.
i will narrate the story & it is like this .
i have bill & bill items table whose view is billwithitem. i populate one billwithitem table with this view. because it a view of combination of bill and its item , the bill primary key bill.ui gets replicated n no of times
i get xml list of bill.ui using
<pre class="prettyprint var xEle = new XElement("Receiptsui", from dt in ds.Tables["billwithitem"].AsEnumerable() select new XElement("ui", dt.Field<Guid>("ui").ToString())); [/code]
<br/>

but i want distinct bill.ui , i tried follwoing
<pre class="prettyprint var xEle = new XElement("Receiptsui", (from dt in ds.Tables["billwithitem"].AsEnumerable() select new XElement("ui", dt.Field<Guid>("ui").ToString())).Distinct()); [/code]
but the result is same.
can some one help and rectify the query to get distinct rows

thanks a lot



View the full article
 
Back
Top