获取错误“对象引用未设置为对象的实例”在创建lique类的对象时“ [英] Getting error "Object reference not set to an instance of an object" while creating object of lique class"

查看:80
本文介绍了获取错误“对象引用未设置为对象的实例”在创建lique类的对象时“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用linq在gridview中显示数据。我第一次使用Linq并得到错误对象引用没有设置为对象的实例plz帮助。

i创建了Tes.dbml并在下面的行中收到错误



TestDataContext cntxt = new TestDataContext(); // error

I want to display data in gridview using linq. I am using Linq first time and getting error "Object reference not set to an instance of an object" plz help.
i have created Tes.dbml and getting error on bellow line

TestDataContext cntxt = new TestDataContext();//error

推荐答案

这不是Linq:它不使用Linq语法,或者Linq方法。



相反,问题很可能出在TextDataContext类的构造函数中 - 所以你需要在调试器中查看它并查找出来它正是在做什么。



我们不能:我们无法访问您的代码或其所依赖的任何数据。
That isn't Linq: it doesn't use Linq syntax, or Linq methods.

Instead, the problem is likely to be in the constructor for the TextDataContext class - so you need to look at that in the debugger and find out exactly what it is doing.

We can't: we don't have access to your code or any of the data on which it depends.


这篇关于获取错误“对象引用未设置为对象的实例”在创建lique类的对象时“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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