woops
Main Topics
Browse All TopicsHi experts
i have this LINQ
Dim searchTrigger As IEnumerable(Of DataRow) = From r As DataRow In Me._dtTrigger.AsEnumerable
Where r.Field(Of String)("BCEID").ToUpper Like searchBuilder.ToString _
Select r _
Distinct
what i have is a datatable with 2 columns, i have to select the whole datarow but i have to filter (distinct) result on one specific field...
can you help me to achieve this?
Kind regards
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi,
the problem is not on the Like operator...
the like works perfectly but i have to distinct result on field
because this linq is on "textChanged" event
suppose the user type "B"
i have to search all the "BCEID" like "B" but the result has to be filtered(distinct) because i have some duplicate rows and i only want to show ONE instance.
regards
that is my query as shown in my previous post
Dim searchTrigger As IEnumerable(Of DataRow) = From r As DataRow In Me._dtTrigger.AsEnumerable
Where r.Field(Of String)("BCEID").ToUpper Like searchBuilder.ToString _
Select r _
Distinct
and i also tried this :
searchBuilder.Append("*").
Dim searchTrigger As IEnumerable(Of DataRow) = (From r As DataRow In Me._dtTrigger.AsEnumerable
Where r.Field(Of String)("BCEID").ToUpper Like searchBuilder.ToString _
Select r).Distinct
as you can see, i put a distinct at the end of query but the result isn't distincted...
Regards
hi, i found the solution :
Dim searchTrigger As IEnumerable(Of DataRow) = (From r As DataRow In Me._dtTrigger.AsEnumerable
Where r.Field(Of String)("BCEID").ToUpper Like searchBuilder.ToString _
Select r).Distinct(New StringComparer("BCEID"))
and i added this custom iequalityComparer :
Public Class StringComparer
Implements IEqualityComparer(Of DataRow)
Private _fieldToCompare As String
Public Sub New(ByVal FieldToCompare As String)
Me._fieldToCompare = FieldToCompare
End Sub
Public Function Equals1(ByVal x As System.Data.DataRow, ByVal y As System.Data.DataRow) As Boolean Implements System.Collections.Generic
Return String.Compare(x.Field(Of String)(Me._fieldToCompare
End Function
Public Function GetHashCode1(ByVal obj As System.Data.DataRow) As Integer Implements System.Collections.Generic
Return obj.ToString.GetHashCode()
End Function
End Class
Thank you anyway ;)
Regards
Business Accounts
Answer for Membership
by: naspinskiPosted on 2008-07-19 at 19:22:59ID: 22044264
Select allOpen in new window