Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2006-11-27
6
2,629 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
imap read mail 1 34
How to create an MVC5, Razor Widget 2 26
Client Validating 2 date fields, required & comparison 1 42
reading excel file in .net 2 15
I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…

856 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