Hi guys!
I've just found an small error, and was wondering whether there is a work around it. I have some code that loads contacts for a client, and it's a company policy to capitalize last names in order to avoid confusions when a consultant has to call someone over the phone. This is the code I'm using to retrieve the contacts in a way I can put them in a ComboBox:
Code:
1 Dim contacts As New Data.ContactsCollection
2 Dim q As Data.ContactsQuery = contacts.Query
3 q.Select((q.LastName.ToUpper + " " + q.FirstName).As("Name"), q.Id).OrderBy("Name", EntitySpaces.Interfaces.esOrderByDirection.Ascending)
4 q.Where(q.ClientID = ClientID)
5 q.Load()
And this is the generated SQL:
Code:
SELECT UPPER(CONCAT(`LastName`,' ',`FirstName`)) AS 'Name',`Id` FROM `contacts` WHERE `ClientID` = ?ClientID1 ORDER BY `Name` ASC
As you can see the UPPER function is wrapping both the first name and the last name, which is not what I want.
Any ideas on a work around? I tried wrapping the q.LastName.ToUpper with parenthesis, but still didn't work.
Cheers,
David