ADO.NET :: To Use Distinct With IEqualityComparer?
Nov 12, 2010public static IEnumerable GetSollicitanten()
View 1 Repliespublic static IEnumerable GetSollicitanten()
View 1 RepliesI have the following table structure:
[code]....
The following query returns the default recordset:
[code]....
I would like to select a distinct query based on three fields and display the rest of the fields. For example,
I have firstname, lastname, address, city, state and zip, but I only want to use the distinct on these fields first and last name. However when i use the distinct function I get a distinct on all the selected rows. I just want to distinct firstname and lastname and display the other fields. for example,
Mary Smith New York
Mary Smithy New York
Mary Smith Maine
I would like the result to be:
Mary Smith New York
Mary Smithy New York
I don't care about Mary Smith Maine, because i am only using the distinct for "Mary Smith" firstname and last name and showing the city.
I have one table(tableName is getDetails and having three column ID, Name, City)
View 6 RepliesHaving some troubles selecting distinct rows.
[Code]....
This is not giving me the wanted results.
Two models:
[code]....
Each ContentVersion is linked to Content through the ContentID.
I want to select all "Content" where UserID = X, then for each selected "Content" I want the latest "ContentVersion".
The return type should be of type <IQueryable>ContentVersion.
I have tableone:
rowid pid gid dis
1 1222 aa dd
2 1222 bb cc
3 1222 cc dd
4 1331 vv cc
5 1331 cc zz
6 1414 zz cc
5 1414 xx zz
I need get distinct pid with rowid together. select * distince pid from tableone However, I get error: select rowid, distinct pid from tableone? Is any way to work out this one?
I am having difficulty in usint distinct with row filter, how to do this without using distinct.As i think distinct does not work with row filter.
Dim dsEName As DataSet = biz.GetEvent()
Dim dt As DataTable = dsEName.Tables(0)
Dim dv As New DataView(dsEName.Tables("dt"))
dv.RowFilter = "DISTINCT EventName "
Me.ddlEventName.DataSource = dv
Me.ddlEventName.DataTextField = "EventName"
Me.ddlEventName.DataValueField = "EventName"
Me.ddlEventName.DataBind()
1.Category:
CatID(Pkey),
CatName,
ParentCatId(Fkey)=> CatID is used as a ParentCatId
2.Comp_Cat:
CCID(Pkey),
CatID,(fkey),
CompID
In my stored Procedure I am passing PageNo,CompID.. My requirement is that One parent CatName is displayed Per page but only one time.
This is something I can easily do in SQL, but I'm pretty new to LINQ and haven't been able to find an answer online.
I need a LINQ query that returns two values; the first a distinct value and the second the count of the first value. This is filtered by a parameter. Here is my table:
[code]....
I am using C# + VSTS 2008 + .Net + ASP.Net + IIS 7.0 + ADO.Net + SQL Server 2008. I have a ADO.Net datatable object, and I want to filter out duplicate/similar records (in my specific rule to judge whether records are duplicate/similar -- if record/row has the same value for a string column, I will treat them as duplicate/similar records), and only keep one of such duplicate/similar records.
The output needs to be a datatable, may output the same datatable object if filter operation could be operated on the same datatable object.
What is the most efficient solution?
how to distinct arraylist value using c#?
View 10 RepliesHere's my current table data.
AccountNumber Product
00505871 Product1
00505871 Product2
00503297 Product3
00900004 Product4
00505871 Product3
00514884 Product3
00503297 Product2
00505871 Product1
How can I achieve following result.
AccountNumber ProductString
00505871 Product1,Product2,Product3,
00503297 Product2,Product3
00900004 Product4
00514884 Product3
I got a requirement from client that he wants to know distinct users information from sites and it sub sites those have access to site. There are separate groups for each subsite (contribute, approval and full access). From these all groups find distinct user information.
How can we do that using Object model?
I would like to get the distinct value form DataTabel using LINQ.
For example my sample table,
[code]....
1. How to get the distinct Country from Country you like column and the return records as Array or DataTable? (I want only India,USA,UK,Germany )
Is there any way to filter the record values using LINQ?
how can i check distinct val in col_1 of datatable and assign seq no to each distinct val of col_1 to col_2?
View 6 RepliesI have a datatable dt with 4 columns. I want to retrieve only distinct values from column1 of datatable.
How can I achieve this using c# code?
I'm not sure if this is the right forum to ask. But I'm using ASP.net 3.5 & I've below code:
[Code]....
Now, I want to check how many elements are present in this distinct array & if the number of elements in this distinct array is more than 500, then I need to fetch only those first 500 elements. How can I achieve this?
I'm trying the pull out a result that shows me how many visitors I have had each day.
My database looks like this.
[code]....
This is my query
Dim s_Person = From Person In db.People Join ProspectStatus In db.ProspectStatus On Person.Id Equals ProspectStatus.Prospect_ID Where (Person.Organization_ID = s_Organization_ID)Select Person.
I only want to return DISTINCT values of Person.ID. Right now, it returns the same person multiple times because there are several entries in the status table.
Dim s_Person = From Person In db.People Join ProspectStatus In db.ProspectStatus
I have an object, that has many properties but the only two to worry about are:
myobject.ID which is an int
myobject.Names which is a HashSet
Then I have a List of those objects that looks something similar to this:
List<myobject>
I use Linq to get a some of the data into a repeater, but I'm not sure how to get the list of Names and how often they show up.
Want to use Linq to avoid having to loop through the data.
As my tags should show, this is an ASP.NET solution using C#.
Some clarification:
Lets say I have just three items in my list:
Item 1 has John, Fred, Jack in its names.
Item 2 has John, Fred, Joe in its names.
Item 3 has John in its names.
I am trying to return the following:
John - 3
Fred - 2
Jack - 1
Joe - 1
Also, as a note I am familiar with having to write my own comparer for my object, I'm just missing the 'how to' for the overall solution in my thoughts.
In my web application, I have 2 totally different databases - one that's being used mostly by a CMS from which we'd like to get page information on non CMS pages on the same website, & one that contains totally different data. Is it possible to use Spring.NET's Open Session In View module with multiple session factories for both of those databases, so in this case I have 2 objects defined in spring.config of type Spring.Data.NHibernate.LocalSessionFactoryObject?
View 1 RepliesI need to bring the distinct result in third columnBelow one is my sample table
[Code]....
If I use a regular distinct selector with MySQL and show the results in a repeater I can show the the data in the webform with the following code.
<%# DataBinder.Eval(Container.DataItem, "posted") %>
But If I use this code:
"SELECT DISTINCT mid(posted,6,1) ORDER BY posted DESC"
I get the following error trying to use the code above.
DataBinding: 'System.Data.Common.DataRecordInternal' does not contain a property with the name 'posted'.
So how do I get the data I've collected with the "DISTINCT mid"-selector to appear in the webform?
How can i filter distinct using for RowFilter?
DataView dataView = employeeDataSet.Tables[0].DefaultView;
dataView.RowFilter = "EmployeeName like '" + searchText + "%'";
GridView_Search.DataSource = dataView;
GridView_Search.DataBind();
i'm binding data to ddl from database.i'm selecting one column from database table to bind.In that column there may be items with same name.but when selecting in ddl there must be no same values.
View 4 Replies