Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DbType equivalent to SqlDbType.Bit

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?

like image 974
Aditi Avatar asked Mar 06 '13 09:03

Aditi


3 Answers

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

like image 123
Guffa Avatar answered Sep 25 '22 06:09

Guffa


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.

like image 35
Damien_The_Unbeliever Avatar answered Sep 25 '22 06:09

Damien_The_Unbeliever


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

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

like image 32
Alex Avatar answered Sep 26 '22 06:09

Alex