Complicated WHERE clause
-
Friday, September 21, 2012 10:40 PM
<asp:EntityDataSource ID="edsOrganizations" runat="server" ConnectionString="name=NRECSEntities" DefaultContainerName="NRECSEntities" EnableFlattening="true" EntitySetName="organizations" EntityTypeFilter="" Include="applicationOrganizations.application, applicationOrganizations, applicationOrganizations.application.person" OrderBy="it.organizationName" Where="EXISTS(SELECT VALUE t FROM it.applicationOrganizations AS t WHERE t.application.person.NRECSUserId = @UserId)"> <WhereParameters> <asp:QueryStringParameter Type="Int16" Name="UserId" /> </WhereParameters> </asp:EntityDataSource>
Here is the Entity data source I'm trying to create. It does not throw an error but instead returns zero rows instead of the 3 it should.
If I remove the "Where" the data source works fine and returns all organizations.
So, what am I trying to do? A person can have 1 application that covers many organizations. I have a listView that should list all Organizations but on the rows where the person did apply to an organization I will display more info from applicationOrganization...(worry about that later in the listview Databound).
I need to return all organizations with the necessary collections of applicationOrganizations for the given UserId (From the Person). Help!
- Edited by GWJones12 Friday, September 21, 2012 10:41 PM formatting messed up
- Moved by Min ZhuMicrosoft Contingent Staff, Moderator Tuesday, September 25, 2012 1:36 AM (From:ADO.NET Entity Framework and LINQ to Entities)
- Moved by Mr. WhartyMicrosoft Community Contributor, Moderator Friday, September 28, 2012 5:45 AM maybe someone on this forum can assist the OP (From:Off-Topic Posts (Do Not Post Here))
- Moved by Min ZhuMicrosoft Contingent Staff, Moderator Tuesday, October 09, 2012 9:44 AM (From:ADO.NET Entity Framework and LINQ to Entities)
All Replies
-
Monday, September 24, 2012 7:16 AM
Hi DaPrograma,
Welcome to the MSDN forum.
Your problem is related to a web control, so I recommend you try this forum on ASP.NET: http://forums.asp.net/1227.aspx/1?ADO+NET+Entity+Framework+LINQ+to+SQL+NHibernate
Sorry for any inconvenience.
Good day.
Alexander Sun [MSFT]
MSDN Community Support | Feedback to us

