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 1-Dec-12 23:43pm
ttds745
Edited 2-Dec-12 7:43am
Nelek51.4K
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 Sergey Alexandrovich Kryukov 921
1 OriginalGriff 250
2 Volynsky Alex 205
3 Kishore Pogaru 160
4 Richard Deeming 140
0 OriginalGriff 5,640
1 Sergey Alexandrovich Kryukov 4,693
2 CPallini 4,540
3 George Jonsson 3,132
4 Gihan Liyanage 2,445


Advertise | Privacy | Mobile
Web02 | 2.8.140916.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