Forum


HomeHomePublicPublicDevelopmentDevelopmentDAL2 questions on functionalityDAL2 questions on functionality
Previous
 
Next
New Post
1/1/2016 12:05 PM
 
1.  With DAL2, is there any way to run a DISTINCT query using DAL2 objects.  In the DAL2 development video there was a find method shown that allowed certain "WHERE" and "ORDER BY" parameters to be passed, but I don't see a way to pass through a DISTINCT parameter. 

 

2.  With DAL2, can objects be joined?  I ask this because some of the custom profile fields are separated by the UserProfile table and the ProfilePropertyDefinition table, and if I want to databind a control, as mentioned in question #1, I'd need databind the control (e.g. listbox) to a query of the joined tables with DISTINCT/singular values displayed for the data selection.

As an example, I have a list box of values on a form to which I want to bind a query with two joined tables. An example of the raw TSQL syntax is: SELECT DISTINCT UserProfile.PropertyValue FROM ProfilePropertyDefinition INNER JOIN UserProfile ON ProfilePropertyDefinition.PropertyDefinitionID = UserProfile.PropertyDefinitionID WHERE PropertyName = 'myCustomProfileFieldName''

Is there anyway to return a similar result to the above query using DAL2?
 
New Post
2/10/2016 8:48 AM
 
You may want to look directly at the Petapoco site (http://www.toptensoftware.com/petapoco/). There are examples of joins, etc, there. Keep in mind you're not joining the resultant objects so the object you ship the join results to should have all the fields. In m case I see fields that are foriegn key values pulled in from the join to [Ignore] so if oyu use the same object on an update or add it doesn't attempt to use it.
 
Previous
 
Next
HomeHomePublicPublicDevelopmentDevelopmentDAL2 questions on functionalityDAL2 questions on functionality



Try FREE
30 days money back guaranteed