Solved

Object reference not set to an instance of an object - from DataSet

Posted on 2006-11-27
6
2,637 Views
Last Modified: 2009-05-28
I am using visual web developer express and I am suddenly getting this error message when I try to build my site:

Error      1      Failed to generate code. Object reference not set to an instance of an object.      C:\Documents and Settings\cut\My Documents\Visual Studio 2005\WebSites\WebSite38\App_Code\MyDataSet.xsd      1      

My dataset was working fine until I opened up Visual Web Developer Express this morning and created a new query on my table adapter using the add query wizard.

Does anyone have any idea what might be going on?
0
Comment
Question by:bizcrown101
  • 2
  • 2
6 Comments
 
LVL 11

Expert Comment

by:ethoths
ID: 18019749
This is usually cause by either not calling New on an object or an null reference being trurned from a method that you expect to return an object. Since this is inside the auto-generated code of xsd yiou don't have too much control over the code in there. My guess is that either you cannot access the database or something in the database has changed. My advise would be to delete the xsd and regenerate it.

0
 

Author Comment

by:bizcrown101
ID: 18019984
Any idea as to what I might look for in the xsd file?

Aside from the one error message, I also get an INSANE amount of warnings about properties in my dataset being empty or null. It's almost as if there should be an instance of my dataset class instantiated somewhere, but it is missing. Is there somewhere in my project where an instance of this class should be created?
0
 
LVL 11

Expert Comment

by:ethoths
ID: 18020010
I would not try to debug the dataset. Any cahanges you make in the auto-generated code will be lost if you need to re-generate the code. Like I said, just delete it and re-create it. If you made it by dragging a stored procedure from the server explorer it'll only take a few minutes.

0
 

Author Comment

by:bizcrown101
ID: 18020218
Rather than deleting the dataset and rebuilding it from scratch (I’m not using stored procedures), I opted to right-click on all the methods on all my table adapters and select "configure". I think this forced all the xml code to be re-built without me having to re-type in all my queries.

This seems to have fixed whatever problem was with my auto-generated dataset code.

Thank you for your suggestions ethoths.
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 18225498
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question