Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

More than one field in one column (boundcolumn, etc.) 1

Status
Not open for further replies.

lonechicken

Programmer
Sep 25, 2001
18
US
Is there an easy way using datagrid or something similar to display more than one field for a certain column?

Say in a database, there are separate firstname and lastname fields. But when I want to display it, I want them in one column listed as lastname, firstname (instead of separate columns).

Like:
Name
----
Doe, John

Instead of having to do:
Lastname Firstname
-------- ---------
Doe John

Am I just going to have to bite the bullet and come up with a more complicated SQL statement to "ready the data" for the datagrid?
 
It is easy to combine two columns into one in a SQL statement:

SELECT LastName + ', ' + FirstName as [FullName]
FROM table
ORDER BY FullName

Then use the column alias FullName in your datagrid or table in your code.

 
Thanks,
I figured as much and was hoping datagrid was more flexible.

The Lastname, Firstname thing is actually a simplistic example of what I'm trying to do, but at least I know which way I'd have to go.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top