DbType is equivalent to SqlDbType.Bit

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

I'm 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 one Bit. Any ideas?

+6
source share
4 answers

The bit database type is represented as logical on the server side, so the corresponding value is DbType DbType.Boolean .

+7
source

DbType.Boolean :

A simple type representing the boolean values ​​true or false.

SqlDbType.Bit :

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

Their description is not entirely consistent, but since Bit described as a Boolean , this is the most appropriate match.

+7
source

http://msdn.microsoft.com/en-us/library/system.data.sqldbtype.aspx

enum SqlDbType - bit: Boolean . An unsigned numeric value, which can be 0, 1, or null.

+3
source

From http://msdn.microsoft.com/en-us/library/fhkx04c4 , I would say DbType.Boolean A simple type that represents boolean values ​​true or false.

+2
source

All Articles