Solved

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

Posted on 2006-11-27
6
2,613 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

772 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now