开发者

sql data type bit

开发者 https://www.devze.com 2023-01-24 07:09 出处:网络
I havesql data type bit and i want to ask if(dr[2] != null开发者_StackOverflow中文版) What changes should make it?

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

精彩评论

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