开发者

sql data type bit

I have sql data type bit and i want to ask

if(dr[2] != null开发者_StackOverflow中文版)

What changes should make it? Sorry for the mistakes I'm not local.


To check if the column value is NULL, use DBNull.Value:

if (dr[2] != DBNull.Value)


Assuming dr is a DataReader, calling dr.IsDBNull(2) will tell you whether it's null.


I wrote like this and the value is NULL dr[2] != System.DBNull.Value and this answer Object cannot be cast from DBNull to other types.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜