I have a scenario where I fetch all the records from a database table using ADO.Net and I want to convert one of the column values which has either "0" or "1". If 0, then "No" should be replaced with 0 and if 1, then it should be "Yes".
For instance, if the following data is there in the table :-

  • Item1 1
  • Item2 0
  • Item3 1

then, it should display in the DataGridView as :-

  • Item1 Yes
  • Item2 No
  • Item3 Yes

Any help is appreciated whether in C# or VB.Net.

Dim value1 as string="Item1 1"
Dim value2 as string=value1.Replace(" 1","Yes")


SELECT CASE fldname WHEN 0 THEN 'No' ELSE 'Yes' END AS fldname
  FROM tablename

Actually I was trying to get the data through ADO.Net in WinForms for a DataGridView, I don't think these suggestions would work for me :)

Hey, I did this one by my own but thanks for your replies anyways :)