Concatenating Two Properties for Display in a DropDownList

后端 未结 3 1251
鱼传尺愫
鱼传尺愫 2021-01-21 00:30

Background

In our last adventure, I was attempting to properly show a Dictionary>. Thanks to the helpful answers in that post, I r

3条回答
  •  粉色の甜心
    2021-01-21 01:07

    As it turns out, the problem is easily solvable if the two columns from the table are concatenated and into one column, like so:

    SELECT Column1Name + ' - ' + Column2Name AS Column3Name FROM Table1 WHERE...

    This turns this:

    Column1Name          Column2Name
    -----------          ----------- 
    Stuff1               Stuff5
    Stuff2               Stuff6
    Stuff3               Stuff7
    Stuff4               Stuff8
    

    Into this:

    Column3Name
    ---------------
    Stuff1 - Stuff5
    Stuff2 - Stuff6
    Stuff3 - Stuff7
    Stuff4 - Stuff8
    

    When all else fails, think a little lower level.

提交回复
热议问题