Anthony McGary

Is there any way to convert a bool variable to a bit. When I read values from the database using the Sql reader I can get the boolean value of a bit field using the reader.GetBoolean(). However, I want to be able to convert this boolean value back to a bit and write to a database. Is there any way to convert bool back to bit

Re: Smart Devices VB and C# Projects Boolean Conversion

Ilya Tumanov

ADO.Net data provider should do that automatically.

If you having difficulties please post your code and exact description of the problem including stack trace, exception type, exception message and errors from error collection for SQL/SQL CE exceptions. Don¡¯t forget to specify like exception is thrown from.






Re: Smart Devices VB and C# Projects Boolean Conversion

Anthony McGary

Discovered the solution. If you want to convert a bool variable for example bool b = true to a bit. Use the Convert.ToByte(bool value). For example Convert.ToByte(b) will convert bool variable b into a bit 1 or 0.