VerySource

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 790|回复: 2

数据载入错误!对象不能从DBunll转换为其类型.错误号13#,三天了没搞定,请高手帮忙。

[复制链接]

2

主题

5

帖子

5.00

积分

新手上路

Rank: 1

积分
5.00
发表于 2020-2-19 22:00:01 | 显示全部楼层 |阅读模式
数据载入错误!对象不能从DBunll转换为其类型.错误号13#

调试runningsun的值为OD


Public runningsum As Double
    Private Sub DataGrid2_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid2.ItemDataBound
        'Dim runningSum As Single
        If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then

            runningsum += Convert.ToDouble(DataBinder.Eval(e.Item.DataItem, "jshj"))

        ElseIf e.Item.ItemType = ListItemType.Footer Then
'e.Item.Cells(3).Text = "<b>签复总金额:</b>   " + String.Format("{0:c}", runningsum)
End If

    End Sub  
回复

使用道具 举报

2

主题

5

帖子

5.00

积分

新手上路

Rank: 1

积分
5.00
 楼主| 发表于 2020-4-27 18:30:01 | 显示全部楼层
调试runningsun的值为OD,实际值为60
回复

使用道具 举报

0

主题

8

帖子

9.00

积分

新手上路

Rank: 1

积分
9.00
发表于 2020-4-27 20:15:01 | 显示全部楼层
你可以这样试下
假设字段strtmp is DBNull
你可以将strtmp写成strtmp.tostring(不用理会有没有显示提示)可以将DBNull转为""(空字符)
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

快速回复 返回顶部 返回列表