![]() |
Concatenate
Is there an easy way to concatenate two columns (i.e. last name and first
name columns) in a data set so both can show up in a data text field of a combo box? |
Re: Concatenate
"Mike Moore" <MikeMoore@discussions.microsoft.com> wrote in message
news:6D6748E5-8F4B-4551-84EB-E17D310D960B@microsoft.com... > Is there an easy way to concatenate two columns (i.e. last name and first > name columns) in a data set so both can show up in a data text field of a > combo box? Easiest way is to do it in your SQL statement e.g. SELECT <...other columns...>, FirstName + ' ' + LastName As FullName, <...other columns...> FROM <...table(s)...> WHERE <...criteria...> Then bind your combo box to the FullName field |
Re: Concatenate
This solves the problem by doing the query a special way, which I already
thought was possible, but more work. what I wanted was a way to combine two columns *after* a query was performed by setting the datatextfield property a certain way. Mike Moore "Mark Rae" wrote: > "Mike Moore" <MikeMoore@discussions.microsoft.com> wrote in message > news:6D6748E5-8F4B-4551-84EB-E17D310D960B@microsoft.com... > > Is there an easy way to concatenate two columns (i.e. last name and first > > name columns) in a data set so both can show up in a data text field of a > > combo box? > > Easiest way is to do it in your SQL statement e.g. > > SELECT <...other columns...>, FirstName + ' ' + LastName As FullName, > <...other columns...> > FROM <...table(s)...> > WHERE <...criteria...> > > Then bind your combo box to the FullName field > > > |
Re: Concatenate
"Mike Moore" <MikeMoore@discussions.microsoft.com> wrote in message
news:0D7BA9B9-B8B3-4328-B9B2-C27AFAEBC45D@microsoft.com... > but more work. Hardly... :-) > what I wanted was a way to combine two columns *after* a query was > performed > by setting the datatextfield property a certain way. I don't believe so. However, you could abandon the DataSource() and DataBind() method of populating the dropdown and instead iterate through the records in the DataSet / DataReader, concatenate the two name fields and then add them to the dropdown using its Items.Add() method. However, I think you'll find that is certainly more work... |
| All times are GMT. The time now is 06:20 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.