C# DbType 相当于 SqlDbType.Bit
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15243333/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
DbType equivalent to SqlDbType.Bit
提问by Aditi
Does anyone know what is the DbType equivalent to SqlDbType.Bit?
有谁知道等价于 SqlDbType.Bit 的 DbType 是什么?
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?
但我不知道使用哪个 DbType 来表示单个位。有任何想法吗?
采纳答案by Guffa
The database type bit
is represented as a boolean on the server side, so the corresponding DbType
value is DbType.Boolean
.
数据库类型bit
在服务器端表示为一个布尔值,因此对应的DbType
值为DbType.Boolean
。
回答by Damien_The_Unbeliever
A simple type representing Boolean values of true or false.
表示真或假布尔值的简单类型。
Boolean. An unsigned numeric value that can be 0, 1, or null.
布尔值。一个可以为 0、1 或 null 的无符号数值。
Their description's don't quite match up, but since Bit
is described as being a Boolean
, it's the most appropriate match.
它们的描述不太匹配,但由于Bit
被描述为 a Boolean
,因此它是最合适的匹配。
回答by Alex
http://msdn.microsoft.com/en-us/library/system.data.sqldbtype.aspx
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.
枚举 SqlDbType - 位:布尔值。一个可以为 0、1 或 null 的无符号数值。
回答by jordanhill123
From http://msdn.microsoft.com/en-us/library/fhkx04c4, I would say DbType.Boolean
A simple type representing Boolean values of true or false.
从http://msdn.microsoft.com/en-us/library/fhkx04c4,我会说DbType.Boolean
一个简单的类型,表示真或假的布尔值。