PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET Object ref. not set to an instance of an object

Reply

Object ref. not set to an instance of an object

 
Thread Tools Rate Thread
Old 12-09-2006, 04:53 AM   #1
cu.4m.srinivas@gmail.com
Guest
 
Posts: n/a
Default Object ref. not set to an instance of an object


hi,

My pgm flow as like this:

parent()
{
a();
b();
  Reply With Quote
Old 12-09-2006, 05:01 AM   #2
Cor Ligthert [MVP]
Guest
 
Posts: n/a
Default Re: Object ref. not set to an instance of an object

Cu,

Objects are no program flow but objects. They have to be available in the
scoop of the project where you are using it, which is forever in or one
level higher than the used scope. The most change you have in this case for
your not instanced OleDbCommand object which you have probably created in a
try block but that we cannot see.

I hope this gives an idea

Cor

<cu.4m.srinivas@gmail.com> schreef in bericht
news:1158033195.598316.190950@i3g2000cwc.googlegroups.com...
> hi,
>
> My pgm flow as like this:
>
> parent()
> {
> a();
> b();
> .
> .
>
> }
>
> a() b()
> { {
> try{} try{ }
>
> catch{} catch{}
>
> } }
>
> My pgm finishes with a(), and while executin b(), the control transfers
> to the catch-blk of a()
> When i try to print the stackTrace in the catch part of a() i get this:
>
> "obj. ref. not set..." at
> System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
> executeResult)
> at
> System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
> behavior, String method)
> at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior
> behavior)
> at <namespace>.<classname>.a()
>
> I cudnt find any null object being accessed in a(), and strangely i
> dont get this exception, when the pgm is executing a() -- how come?
>
> a() : Query operation
> b(): FTP operations ( i.e. file access to the remote server)
>
> Could you please help me out in this ?...thx in advance
>
> Thanks
> Freak
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off