How to write a select statement

  • Thread starter Thread starter Tony Johansson
  • Start date Start date
T

Tony Johansson

Is it possible to write a select statement that return both FName and LName
as just FullName with a space in between
something like Select (FName + " " + LName) as FullName from employees

So I can use FullName when I bind to a dropdownlist
ddlEmployee.DataSource = backEnd.GetEmployees ();
C.DataTextField = "FullName ";
ddlEmployee.DataValueField = "EId";
ddlEmployee.DataBind();

//Tony
 
Is it possible to write a select statement that return both FName and
LName
as just FullName with a space in between
something like Select (FName + " " + LName) as FullName from employees

Select (FName + ' ' + LName) as FullName from employees

should work fine with SQLServer (and most other databases).
So I can use FullName when I bind to a dropdownlist
ddlEmployee.DataSource = backEnd.GetEmployees ();
C.DataTextField = "FullName ";
ddlEmployee.DataValueField = "EId";
ddlEmployee.DataBind();

I would feel tempted to separate the SQL and the
UI a little bit more.

dropdown----List<ClassWithFullName>----List<ClassWithFNAmeAndLName>----SQL

Arne
 
Back
Top