Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
2.Columns UOM1 and UOM2
 
UOM1        UOM2
---         ---
PIECES      BOX
 

what I want to display in combobox is
 
PIECES
BOX
 

How could I write to get that fromat.
 
OP's additional content moved from non-solution below
thanks for your reply (solution 1 by _TR_)
 
3Columns Produtct_Id, UOM1 and UOM2 in a table

 
Product_Id     UOM1       UOM2
-----------     ---        ---
   1.          PIECES      BOX
   2.          BOTTLE      CTN
   3.          PACKET      BAN
 

what I want to display in combobox is based on the product_id, while I choose Product_Id 1 from a Combobox, want to bind UOM1 and UOM2 value in the another combobox. Not all the data.
 
for example: select Product_Id 1.
 
just only display those two data on combobox.

PIECES
BOX
 
How should I rewrite the sql statement?
Although I try to use that statement, show all the data in.
 
create procedure GetTwoProduct
(
    @id int
)
as
 
SELECT UOM1_Code AS UOM FROM Product
UNION ALL
SELECT UOM2_Code AS UOM FROM Product
where Product.Product_Id = @id
Posted 2-Dec-12 0:43am
ttds802
Edited 2-Dec-12 8:43am
Nelek63.5K
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Assuming you are retrieving data from database, you can try
SELECT UOM1 AS UOM FROM [YourTable]
UNION ALL
SELECT UOM2 AS UOM FROM [YourTable]
 
The columns UOM1 and UOM2 should be of same data type.
 
Let me know if you have any doubts.
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 DamithSL 270
1 OriginalGriff 184
2 BillWoodruff 170
3 Zoltán Zörgő 165
4 Sergey Alexandrovich Kryukov 125
0 OriginalGriff 7,760
1 DamithSL 5,874
2 Sergey Alexandrovich Kryukov 5,444
3 Maciej Los 5,076
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 2 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100