I have a database with where boolean values are stored as bits (1 for true, 0 for false). What’s the best way of converting these into .Net boolean values from a DataRow? Convert.ToBoolean doesn’t seem to work.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If the data type in the database is
bit, then you don’t have to do any conversion at all. The database driver automatically reads the values as booleans, all you have to do is to unbox the value: