Custom class error: "Object reference not set to an instance of an object."

Custom class error: "Object reference not set to an instance of an object."

Post by Nick Gilber » Wed, 13 Mar 2002 22:06:03



Hi,

I've started writing a class to build some SQL to run but I'm having a
problem.
When I try and call the method that returns the SQL string, I get the
following error: "Object reference not set to an instance of an object."

    string strSQL;
    AdvSearchBuilder myQuery = new AdvSearchBuilder();
    myQuery.SelectColumns = "VenueName,Town";
    myQuery.VenueName = VenueName.Text;
    strSQL = myQuery.GetSQL();  // error is indicated on this line.

What does this mean? Which object is it referring to?

Thanks,

Nick...
(please reply to group)

 
 
 

Custom class error: "Object reference not set to an instance of an object."

Post by Jim Ross [MVP » Wed, 13 Mar 2002 23:45:51


My guess is that there is some problem within the GetSQL function.


>Hi,

>I've started writing a class to build some SQL to run but I'm having a
>problem.
>When I try and call the method that returns the SQL string, I get the
>following error: "Object reference not set to an instance of an object."

>    string strSQL;
>    AdvSearchBuilder myQuery = new AdvSearchBuilder();
>    myQuery.SelectColumns = "VenueName,Town";
>    myQuery.VenueName = VenueName.Text;
>    strSQL = myQuery.GetSQL();  // error is indicated on this line.

>What does this mean? Which object is it referring to?

>Thanks,

>Nick...
>(please reply to group)

Jim Ross
MS MVP [VC/MFC]

To send email, change 'lotsofspamthroughhere' to 'msn' but please ask all questions in the newsgroups, not via private mail

 
 
 

Custom class error: "Object reference not set to an instance of an object."

Post by Nick Gilber » Wed, 13 Mar 2002 23:58:55


Quote:> My guess is that there is some problem within the GetSQL function.

You're right (again!). But the error page in ASP.NET really doesn't make it
clear where the error actually is if you're using custom compiled DLLs. I
presume this is because they're not compiled in debug mode so it can't get
the line numbers and thus show you the source code? It took me ages to
figure out where the error *really* was...

Thanks for your help,

Nick...

 
 
 

Custom class error: "Object reference not set to an instance of an object."

Post by Jim Ross [MVP » Thu, 14 Mar 2002 02:08:36


Ahhh... but you said that you were developing the class internally, so
you should be able to build a debug version and step into the
statement in the de*.

Useful little *, that de*. Can be your very bestest friend
ever if you just give him the chance.


>> My guess is that there is some problem within the GetSQL function.

>You're right (again!). But the error page in ASP.NET really doesn't make it
>clear where the error actually is if you're using custom compiled DLLs. I
>presume this is because they're not compiled in debug mode so it can't get
>the line numbers and thus show you the source code? It took me ages to
>figure out where the error *really* was...

Jim Ross
MS MVP [VC/MFC]

To send email, change 'lotsofspamthroughhere' to 'msn' but please ask all questions in the newsgroups, not via private mail

 
 
 

Custom class error: "Object reference not set to an instance of an object."

Post by Nick Gilber » Thu, 14 Mar 2002 02:32:31


Quote:> Ahhh... but you said that you were developing the class internally, so
> you should be able to build a debug version and step into the
> statement in the de*.

Yeah - except you're assuming I can afford Visual Studio - when in fact I'm
using a text editor and an SDK :) There is still a crappy command line
de* which just about shows me what I want to know.

I don't like learning new things in Visual Studio because I hate the way it
writes blocks of code for you and generally confuses you. If there was a way
that you could just use it as a text editor then I might consider it. Maybe
it's not as bad for ASP.NET as it is for MFC...

Thanks again,

Nick...