Click here to Skip to main content
15,895,256 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a c# windows application, that has a datagridview connected to SQL server database. I want to replace data with string equivalent data of integer of that in one column. I don't know, how to do this.
for example in a column we have:
0
1
1
0
2

I want to replace 0 with passed, 1 with returned, 2 with waiting

Thank you
Posted
Updated 16-Dec-10 16:01pm
v3
Comments
Abdul Quader Mamun 16-Dec-10 22:01pm    
Spelling check & decorate question.

1 solution

Probably the easiest way is to change your query to use a CASE statement when selecting, for example:
SQL
SELECT CASE columnValue WHEN 0 THEN 'passed' WHEN 1 THEN 'returned' WHEN 2 THEN 'waiting' ELSE 'invalid code' END AS ReadableStatus FROM tableName


Otherwise, you will probably need to create a TypeConverter to use in the column's CellTemplate[^]
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900