tags:

views:

49

answers:

2

Hi I've a query like this

select * from emplyees

result is

name    dept      status
emp1    Admin      y
emp2    admin      n

I'm going to bind it to gridview like mygridview.datasource = ds;

now here i want to display approve instead of y and disapprove instead of n

how can i write a query ?

thank you

+7  A: 

You don't state what database you are using. If you are using SQL Server, then you could write this as:

SELECT name, dept, CASE WHEN STATUS = 'Y' THEN 'Approve' ELSE 'Disapprove' END AS STATUS
FROM EMPLOYEES
Pete OHanlon
thank you its working
Nagu
You're welcome. I'm glad to help.
Pete OHanlon
A: 

You can use DataGridView (Windows Forms) cell formatting mechanism to format value of a cell.

Here's an example.

Beatles1692
No i'm using web application.. any how i got the answer from the above query thank you
Nagu