Topic: Not getting the results with Left Join? |
Posted On: 5/19/2009 3:02 AM
Posted By: Ryan Aljets
|
Hello,
I can't seem to be getting any results with the following code. What am I doing wrong?
| using (Users u = new Users()) |
| { |
| u.ObjectMode = ObjectModes.Search; |
| u.Join_DepartmentID_Departments_Parent(JoinTypes.Left); |
| u.DepartmentID_Departments_Parent.DivisionID.Value = 1; |
| u.Find(); |
| return u.GenericList; |
| } |
| |
I have checked the AffectedRows property is 0 and ErrorString is also null. The data is also there in the table.
Cheers,
Ryan
Can you please check see if you have record in departments table with division id 1?
In case you looking to get result where either division id is null or division id is equal to 1 then you need to specify ValueOrNull to SearchMode property of the division id field.
| u.DepartmentID_Departments_Parent.DivisionID.SearchMode = SearchModes.ValueOrNull; | | u.Find(); |
Please let me know if this don't resolve your problem.
Regards, Victor
Quick Objects Support
| 5/19/2009 6:02:49 PM Victor Gavriluk
|
Victor,
Thank you for the reply. I added ValueOrNull and it works perfectly!
Cheers, Ryan
| 5/20/2009 7:21:46 AM Ryan Aljets
|