Formulating a Select As

Posts   
 
    
lpaulding
User
Posts: 2
Joined: 07-Sep-2006
# Posted on: 13-Oct-2006 22:37:44   

How do you write this in LLBLGen code:

SQL = "Select FirstName + ' ' + Lastname as FullInfo from Users

I need to do this so that on my dropdown list control I can use "FullInfo" as my DataTextField.

mikeg22
User
Posts: 411
Joined: 30-Jun-2005
# Posted on: 14-Oct-2006 02:12:54   

The way I've done this is by making a custom property, in the entity class itself, that would return FirstName + Lastname. If you want binding to work, you would have to raise the PropertyChanged event whenever FirstName or LastName changed.

Chester
Support Team
Posts: 223
Joined: 15-Jul-2005
# Posted on: 14-Oct-2006 22:07:25   

mikeg22 wrote:

The way I've done this is by making a custom property, in the entity class itself, that would return FirstName + Lastname. If you want binding to work, you would have to raise the PropertyChanged event whenever FirstName or LastName changed.

Exactly.

BertS
User
Posts: 89
Joined: 28-Jul-2005
# Posted on: 17-Oct-2006 09:05:14   

When binding to a dropdownlist, you probably do not want to use an entitycollection (because of the overhead), but a dynamiclist. In that case, you should have a look at Expressions (explained in the docs).