How to write a select statement

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
 
A

Arne Vajhøj

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top