群里的一位朋友问如何在逻辑层判断null字段,我写了个demo,顺便来个post.
判断是否为null,在framework中有个类,叫做DBNull类,判断某个列是否为空,可以采用以下办法:
1   if (ds.Tables[0].Rows[0]["NullField"] == DBNull.Value)   

2  if (ds.Tables[0].Rows[i]["NullField"] is DBNull)

这两种办法都经过我的demo测试,均可以。