Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object Reference is not set to an instance of object....

Status
Not open for further replies.

Mike2020

Programmer
Mar 18, 2002
55
0
0
US
Hi Folks,



I develop a .NET web application, it run just find on my old machine. Now I copy/move it to other machine/server.

Both machine have have framework version v1.1.4322, and of course both have Visual Studio .NET.

But when I run the application on the new machine, I get this error:

=========================================================
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:


Line 224: dr.Close()
Line 225: End If
Line 226: cnn.Close()
Line 227: cnn = Nothing
Line 228: cmd.Dispose()


Source File: c:\inetpub\ Line: 226

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
EEOC.EEO1_Main.load_year() in c:\inetpub\ EEOC.EEO1_Main.Page_Load(Object sender, EventArgs e) in c:\inetpub\ System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731

===========================================
The code below is at that section.

Private Sub load_year()
Dim cnn As OracleConnection
Dim cmd As OracleCommand
Dim dr As OracleDataReader

Dim SQL As String = "select * from table(cast(emp_inds_query.get_years() as emp_year_list_tab))"
Try
cnn = New OracleConnection(ConfigurationSettings.AppSettings("strConn"))
cnn.Open()
cmd = New OracleCommand(SQL, cnn)
dr = cmd.ExecuteReader()

ddl_year.DataSource = dr
ddl_year.DataTextField = "YEAR"
ddl_year.DataValueField = "YEAR"
ddl_year.DataBind()

Catch ex As Exception
Label1.Text = ex.ToString
Finally
If Not dr Is Nothing Then
dr.Close()
End If
cnn.Close()
cnn = Nothing
cmd.Dispose()

End Try
End Sub

=====================

Please help....

Thanks....

Mike
 
This may have nothing to do with your problem, but recently I had a similar problem with moving an application from my PC (where it worked) to a server (where it didn't).

It turned out that there was a problem with the .NET Framework 1.1. I was able to fix the problem by downloading the .NET Framework 1.1 service pack SP1 from the msdn website and installing it on the server.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top