利用Sstem .Data.DataSet为载体,从数据库中取得数据,当没有检索到数据时
DataSet.Tables(0).Rows(0).Item(0)返回就是"System.DBNull"
此时如果进行判断,那么判断条件应该是
if DataSet.Tables(0).Rows(0).Item(0) is System.DBNull.Value then
.....
End if
而不是习惯上想象的 is System.DBNull
本文介绍如何正确使用System.Data.DataSet从数据库检索数据,并解释了在未检索到数据时如何通过DataSet.Tables(0).Rows(0).Item(0)判断是否为System.DBNull.Value。
利用Sstem .Data.DataSet为载体,从数据库中取得数据,当没有检索到数据时
DataSet.Tables(0).Rows(0).Item(0)返回就是"System.DBNull"
此时如果进行判断,那么判断条件应该是
if DataSet.Tables(0).Rows(0).Item(0) is System.DBNull.Value then
.....
End if
而不是习惯上想象的 is System.DBNull
1200

被折叠的 条评论
为什么被折叠?