object无法从dbnull转换为其他类型 [英] object cannot be cast from dbnull to other type

查看:78
本文介绍了object无法从dbnull转换为其他类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



我尝试将数据绑定到DataGrid时遇到错误

  无法将对象从dbnull转换为其他类型



一件重要的事情是,当我在本地系统中运行此代码时,它运行正常。在部署之后,前2,3次它工作正常,但后来只有我从服务器收到此错误



我不知道为什么会发生这样的事情



最近我添加了 ICSharpCode.SharpZipLib.dll Microsoft.Office.Interop .Excel.dll 解决方案。



这些DLL是否有误?任何关系?



请帮帮我。

解决方案

数据gridview只接受可枚举的数据源

Hi All

I am getting below error when I try to bind data to DataGrid

"object cannot be cast from dbnull to other type".


One important thing is that when i run this code in my local system it is working fine. after deployement , for first 2,3 times it is working fine but later only iam getting this error from server

I don''t know why it is happening like this

And recently I added ICSharpCode.SharpZipLib.dll and Microsoft.Office.Interop.Excel.dll to solution.

Are these DLLs reason for error? Any relation?

Please help me out.

解决方案

data gridview only accepts data sources that are enumerable.


这篇关于object无法从dbnull转换为其他类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆