[Webinar] Learn how to a build a cloud-first strategyRegister Now


Object reference not set to an instance of an object.

Posted on 2006-04-27
Medium Priority
Last Modified: 2013-11-26
I am not a developer, but this is what I have on my plate.
This app was written to run on using SQL 2000 and .Net Framework 1.1
I am running it using SQL 2005 (which has to have framework 2.0 installed) but I also have 1.1 installed and have it selected in IIS for this app to use 1.1. I do not believe this is a SQL issue, I figure the code just may have to be spruced up for 05,  but I may be dead wrong.

I navigate to the web apps URL and the app launches and runs fine, lets me login and all, until I try to run a search of the database. The error below is what I get instead of correct output.
Where does the stack trace come from? Is that the app .net or Sql or what?
Can anyone help point us in the right direction or is this way to generic?

Server Error in '/LQ' Application.

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   LQAS.NET.CustomerSearchGrid.Page_Load(Object sender, EventArgs e)
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +750


Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET Version:1.1.4322.2300
Question by:Jeremy_Wiley
LVL 11

Assisted Solution

WelkinMaze earned 500 total points
ID: 16552901
It seems that some object reference is null. You can look through the code and try to find it ot post some parts of the code here.

Assisted Solution

barisgomlek earned 500 total points
ID: 16554684
First put a break in your code that runs when you press the search button (or any action that triggers the search).

The go line by line.


a better solution to catch the error is to force Visual studio to break into the code when error happens:
1. In the Debug menu navigate to Exceptions.
2. Select "Common Language Runtime Exceptions" and Check "Break Into Debugger" in the first group.
3. Run.

When an exception is thrown you will see the code that causes the exception. It can be a variable that is not initialized, so initialize it with "new". You can paste the code so we can look at it.

Assisted Solution

wnross earned 500 total points
ID: 16557768
Check your "SQL Server Surface Area Configuration" and "SQL Server Configuration Manager",

In particular, check the latter under Network Configuration and Client configuration to see if "TCP/IP" is enabled

Then if everything looks good, create a small page as follows:

<%@ Import Namespace="System.Data.SqlClient" %>
<Script Runat="Server">
   Sub Page_Load
      Dim custDb As SqlConnection
      custDb = New SqlConnection("Server=localhost;uid=myID;pwd=mypassword;database=customer")
   End Sub

If you get a blank page: w00t!
If you get an error page, well...

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 16563822
Thanks for the input so far everyone. It will probably take me a few days to get a hold of code or anything else helpful. I'll let you know as soon as i have somthing to work with. If I can't obtain anything helpful in a reasonable amount of time I'l just close the call and split points...

Accepted Solution

yokkui earned 500 total points
ID: 16593799
I also used to have a similar problem before. My app which ran on .Net 1.1 couldn't access its database running on SQL Server 2000 after I installed SQL Server 2005. In the end, I just ended restoring Windows to the point just before the installation of SQL Server 2005, then the issue was solved. You may resort on this solution provided there is no any other way.

Author Comment

ID: 16595997
My hands are tied, and I can't get any more useful information than I have already provided. It's up to the devs now since they won't hand over code. I'll split.


Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

In this post we will learn different types of Android Layout and some basics of an Android App.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Introduction to Processes
Loops Section Overview

865 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