DbType equivalent to SqlDbType.Bit

Aditi picture Aditi · Mar 6, 2013 · Viewed 24k times · Source

Does anyone know what is the DbType equivalent to SqlDbType.Bit?

I am trying to convert

param[0] = new SqlParameter("@Status", SqlDbType.Bit);
param[0].Value = Status;

to

db.AddInParameter(dbCommand, "@Status", <DbType dbType>, Status);

but I don't know which DbType to use to represent a single Bit. Any ideas?

Answer

Damien_The_Unbeliever picture Damien_The_Unbeliever · Mar 6, 2013

DbType.Boolean:

A simple type representing Boolean values of true or false.

SqlDbType.Bit:

Boolean. An unsigned numeric value that can be 0, 1, or null.

Their description's don't quite match up, but since Bit is described as being a Boolean, it's the most appropriate match.