Concatenate

Discussion in 'ASP .Net' started by =?Utf-8?B?TWlrZSBNb29yZQ==?=, Nov 24, 2004.

  1. 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?
    =?Utf-8?B?TWlrZSBNb29yZQ==?=, Nov 24, 2004
    #1
    1. Advertising

  2. =?Utf-8?B?TWlrZSBNb29yZQ==?=

    Mark Rae Guest

    "Mike Moore" <> wrote in message
    news:...
    > 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
    Mark Rae, Nov 24, 2004
    #2
    1. Advertising

  3. 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" <> wrote in message
    > news:...
    > > 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
    >
    >
    >
    =?Utf-8?B?TWlrZSBNb29yZQ==?=, Nov 24, 2004
    #3
  4. =?Utf-8?B?TWlrZSBNb29yZQ==?=

    Mark Rae Guest

    "Mike Moore" <> wrote in message
    news:...

    > 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...
    Mark Rae, Nov 24, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike James
    Replies:
    1
    Views:
    1,827
    Jim Gibson
    Sep 19, 2003
  2. Luis E Valencia

    Concatenate Hyperlink with databinder

    Luis E Valencia, May 27, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    1,693
    Luis E Valencia
    May 27, 2004
  3. Luis Esteban Valencia

    Concatenate datalist variables with javascript and html

    Luis Esteban Valencia, Jan 20, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    2,623
    Luis Esteban Valencia
    Jan 20, 2005
  4. =?Utf-8?B?am9uZWZlcg==?=

    Can't concatenate for data adapters

    =?Utf-8?B?am9uZWZlcg==?=, Oct 11, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    398
    S. Justin Gengo
    Oct 17, 2005
  5. Carlos

    Concatenate/De-Concatenate

    Carlos, Oct 12, 2012, in forum: VHDL
    Replies:
    10
    Views:
    874
Loading...

Share This Page