运行我的应用程序时出现的错误 [英] error that i gt when i run my application
本文介绍了运行我的应用程序时出现的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对象引用未设置为对象的实例.在第68行:while(dr.Read())我不明白该错误,请帮助pple !!!
Object reference not set to an instance of an object. in Line 68: while (dr.Read()) i do not understand that error please help pple!!!
推荐答案
如果您确定引发了异常恰好在该行中,这仅意味着dr
等于null
.检查此对象的构造位置,并确保在取消引用时该对象不为null;或更改代码的逻辑以检查if (dr != null) …
以仅在不为null时使用它.始终在调试器下运行它,以确保所有对象都获得适当的值.
实际上,只要您对运行时行为有一点担忧,就应该使用调试器(不仅当您遇到意外的异常时),而且在提出问题之前也应使用调试器.做功课,以充分利用可能获得的帮助.
—SA
If you are sure that the exception is thrown exactly in that line, it can only mean thatdr
is equal tonull
. Check up where this object is constructed and make sure it''s not null at the moment of de-referencing; or change the logic of the code to checkif (dr != null) …
to use it only when it is not null. Always run it under debugger to make sure all object gets appropriate value.
Actually, you should use the debugger whenever you have a slightest concern about your run-time behavior (not only when you have an unexpected exception), and also before you ask a question. Do your homework to get the most from the help you may get.
—SA
这篇关于运行我的应用程序时出现的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文