Convert Yes/No/Null from SQL to True/False in a DataTable
- by Scott Chamberlain
I have a Sql Database (which I have no control over the schema) that has a Column that will have the varchar value of "Yes", "No", or it will be null. For the purpose of what I am doing null will be handled as No.
I am programming in c# net 3.5 using a data table and table adapter to pull the data down. I would like to directly bind the column using a binding source to a check box I have in my program however I do not know how or where to put the logic to convert the string Yes/No/null to boolean True/False;
Reading a null from the SQL server and writing back a No on a update is acceptable behavior.
Any help is greatly appreciated.
EDIT --
This is being developed for windows.