By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,775 Members | 1,345 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,775 IT Pros & Developers. It's quick & easy.

NullReferenceException on an already instanciated object

P: n/a
Hello, I have a perplexing situation. I have the following set of code, which
depends on a scheduling library from GravityBox software (Schedule.NET 2005).
Nobody in their forums has been able to help me resolve this problem:

scheduleDomainController1.ConnectionString =
"data source=.\\SQLExpress;database=MyDatabase;Integrate d Security=True;";

string AccountID = "00000000-0000-0000-0000-000000000000";

try
{
dataSet1 =
scheduleDomainController1.GetScheduleDataSet(Accou ntID);

}
catch (Exception ex)
{
MessageBox.Show(ex.Message + ex.StackTrace);
}
schedule1.DataSource = dataSet1;
schedule1.Bind();
The line above: dataSet1 =
scheduleDomainController1.GetScheduleDataSet(Accou ntID);

is always raising an exception: NullReferenceException.
"Object reference not set to an instance of an object"

dataSet1 is instanciated/created at runtime as well as
scheduleDomainController1.

I'm miffed here as to why I'm getting this exception. Any clues?

Thanks
Mike

May 13 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Is it occurring as a result of the line itself (which seems impossible
given the snippet you posted) or is it occurring somewhere within the
GetScheduleDataSet method? That is, does the stack trace terminate in
your code, or within GetScheduleDataSet?

May 13 '06 #2

P: n/a
eljainc <el*****@discussions.microsoft.com> wrote:
Hello, I have a perplexing situation. I have the following set of code, which
depends on a scheduling library from GravityBox software (Schedule.NET 2005).
Nobody in their forums has been able to help me resolve this problem:
<snip>
I'm miffed here as to why I'm getting this exception. Any clues?


Not without more code. Does the AccountID property raise the exception,
perhaps?

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
May 13 '06 #3

P: n/a
Thanks for the help so far. However I am thinking now that it is a problem
making a connection properly with the SQL Server. SSE is running on the same
computer as the client (for testing purposes).

All objects are created properly. The AccountID is a instanciated object as
are
dataSet1 and scheduleDomainController1.

Any other advice appreciated.
"Jon Skeet [C# MVP]" wrote:
eljainc <el*****@discussions.microsoft.com> wrote:
Hello, I have a perplexing situation. I have the following set of code, which
depends on a scheduling library from GravityBox software (Schedule.NET 2005).
Nobody in their forums has been able to help me resolve this problem:


<snip>
I'm miffed here as to why I'm getting this exception. Any clues?


Not without more code. Does the AccountID property raise the exception,
perhaps?

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

May 15 '06 #4

P: n/a
Thanks for the suggestions. It would be somewhat difficult to post a complete
example as this program has dependencies on a commercial .NET class. I would
have to involve some licensing issues which are a bit complicated, not to
mention the fact that our application is proprietary in nature. If I do have
enough time, I may be able to resolve this problem and post a sample program
that can reproduce the problem.

At this point, it is my sneaking hunch that the SSE (SQL Server Express)
setup and management/configuration is the culprit. I'm not a SQL guru and am
still learning the ropes so to speak.

Mike
"Jon Skeet [C# MVP]" wrote:
eljainc <el*****@discussions.microsoft.com> wrote:
Hello, I have a perplexing situation. I have the following set of code, which
depends on a scheduling library from GravityBox software (Schedule.NET 2005).
Nobody in their forums has been able to help me resolve this problem:


<snip>
I'm miffed here as to why I'm getting this exception. Any clues?


Not without more code. Does the AccountID property raise the exception,
perhaps?

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

May 15 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.