无法将类型为“System.DBNull”的对象强制转换为类型“System.String”。

2025-05-01 02:10:48
推荐回答(1个)
回答1:

很明显,(string)Eval("p_countions")转换错误。Eval("p_countions")的结果是System.DBNull,而System.DBNull不能执行强制类型转换的,如果只是看结果,用Eval("p_countions").ToString()却不会报错,它返回空。当前你可以先判断再转换了