NullReferenceException on an already instanciated object

G

Guest

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;Integrated Security=True;";

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

try
{
dataSet1 =
scheduleDomainController1.GetScheduleDataSet(AccountID);

}
catch (Exception ex)
{
MessageBox.Show(ex.Message + ex.StackTrace);
}
schedule1.DataSource = dataSet1;
schedule1.Bind();


The line above: dataSet1 =
scheduleDomainController1.GetScheduleDataSet(AccountID);

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
 
B

Bruce Wood

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?
 
J

Jon Skeet [C# MVP]

eljainc said:
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:

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.
 
G

Guest

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.
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top