无法将类型为 System.DBNull 的对象强制转换为类型 System.String 怎么办(为什么不能把int强制转换为string)

无法将类型为 System.DBNull 的对象强制转换为类型 System.String 怎么办(为什么不能把int强制转换为string)

首页休闲益智挪车位汽车华容道更新时间:2025-05-07

无法将类型为 System.DBNull 的对象强制转换为类型 System.String 怎么办,为什么不能把int强制转换为string

很明显,(string)Eval("p_countions")转换错误。

Eval("p_countions")的结果是System.DBNull,而System.DBNull不能执行强制类型转换的,如果只是看结果,用Eval("p_countions").ToString()却不会报错,它返回空。

当前你可以先判断再转换了

大家还看了
也许喜欢
更多游戏

Copyright © 2024 妖气游戏网 www.17u1u.com All Rights Reserved