加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

如何检查vb.net中的空值

发布时间:2020-12-17 00:10:38 所属栏目:大数据 来源:网络整理
导读:这听起来像蛋糕,但请接受我的无知,并帮助我. 我有这个: If String.IsNullOrEmpty(editTransactionRow.pay_id.ToString()) = False Then stTransactionPaymentID = editTransactionRow.pay_id 'Check for null value End If 现在,当编辑TransactionRow.pay_i
这听起来像蛋糕,但请接受我的无知,并帮助我.

我有这个:

If String.IsNullOrEmpty(editTransactionRow.pay_id.ToString()) = False Then
        stTransactionPaymentID = editTransactionRow.pay_id 'Check for null value
    End If

现在,当编辑TransactionRow.pay_id是Null vb thhrows异常?这段代码有什么问题吗?

如果您使用强类型数据集,那么您应该这样做:
If Not ediTransactionRow.Ispay_id1Null Then
    'Do processing here'
End If

您收到错误的原因是,强类型数据集将检索基础值并公开通过该属性的转换.例如,这里基本上是发生了什么

Public Property pay_Id1 Then
   Get
     return DirectCast(me.GetValue("pay_Id1",short)
   End Get
   'Abbreaviated for clarity'
End Property

发生什么是GetValue方法返回不能转换为short的DBNull.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读