Finding null value in Dataset - DataRow.IsNull method vs ==DbNull.Value - c#

后端 未结 5 635
夕颜
夕颜 2021-01-01 20:32

What are the benefits of using the c# method DataRow.IsNull to determine a null value over checking if the row equals DbNull.value?

if(ds.Tables[0].Rows[0].I         


        
5条回答
  •  盖世英雄少女心
    2021-01-01 20:57

    It gives the table has check null value in rows

    if (! DBNull.Value.Equals(dataset.Tables["tablename"].Rows[n][0].ToString())) {
        //enter code here
    } else {
      //enter code here
    }
    

提交回复
热议问题