Recent Posts

Tags

Community

Email Notifications

All Links

Blogs I Read

My Articles

JavaScript & CSS

Date & Time

SQL Server 2000/2005

Articles I Read

ASP.NET Free Controls

MVFP (Most Valuable Forum Posts)

Archives

Bit Column in SQL Server

In my work today, I faced a very weird thingy, here it is:

I was retreiving a bit column from the table whose default value is set to 0, and then using an SqlDataReader, and the weird thing is that I used:

1- (bool)reader[col]
2- Convert.ToBoolean(reader[col]])
3- reader.GetInt32(col)

Nothing worked but:

Convert.ToBoolean( Convert.ToByte( reader[col] ) )

Can anyone explain why that happened? I beleive, option #1 should work pretty simple.

Regards

Leave a Comment

(required) 

(required) 

(optional)

(required)