Object reference not set to an instance of an object.

From: kon george (kon.georgopoulos_at_optus.com.au)
Date: 02/18/05


Date: Thu, 17 Feb 2005 19:52:39 -0800


Can somebody assist. I build this code on a dev laptop and copied across
the
 entire code to a Windows 2003 server with 1.1 framework. It is basic
ASP.NE
T that uses web service for SQL Server 2000 DB access.

The code works fine on my dev laptop, just not on the non dev machine.

Here is the full error page:

Server Error in '/jobRequest' Application.
------------------------------------------------------------------------

----
----
Object reference not set to an instance of an object. 
Description: An unhandled exception occurred during the execution of the
cur
rent web request. Please review the stack trace for more information
about t
he error and where it originated in the code. 
Exception Details: System.NullReferenceException: Object reference not
set t
o 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
objec
t.]
   jobRequest.requestProof.Button1_Click(Object sender, EventArgs e)
+125
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.Rai
s
ePostBackEvent(String eventArgument) +57
   System.Web.UI.Page. RaisePostBackEvent(IPostBackEventHandler
 sourceControl
, String eventArgument) +18
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
+33
   System.Web.UI.Page.ProcessRequestMain() +1277
------------------------------------------------------------------------
----
----
Version Information: Microsoft .NET Framework Version:1.1.4322.573;
ASP.NET 
Version:1.1.4322.573 
AND here is the requestProof snippet:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.E
ventArgs) Handles Button1.Click
        'insert code here for database insertion
        Dim myJobRequest As New skillsDB.jobRequest
        ' a web method is called to check whether the name exists or not
        Dim checkName As New skillsDB.jobRequest
        Dim userNameSet As DataSet = checkName.findUser(Session("Name"))
        ' if exists then perform and update
        If (userNameSet.Tables(0).Rows.Count <> 0) Then
            Dim updateSkillsIndex As DataSet =
myJobRequest.userUpdate(Sessi
on("Name"), Session("BadgeID"), Session("Division"),
Session("Location"), Se
ssion("Data"), Session("Voice"), Session("Converged"),
Session("Security"), 
Session("Hosting"), Session("ContactCentres"),
Session("Infrastructure"), _
Session("
Applications"), Session("EMC"), Session("D2WProcess"),
Session("CostingSprea
dsheets"), Session("SalesProcess"), Session("TAS"),
Session("ManageRelations
hips"), Session("CustomerFocus"), _
Session("
CommunicationSkills"), Session("DefineBuyingCriteria"),
Session("DecisionMak
ing"), Session("IssueResolution"), Session("BidManagement"),
Session("Vendor
Management"), _
Session("
Proposals"), Session("Negotiation"), Session("Presentation"),
Session("Contr
actWriting"), Session("BusinessCaseWriting"),
Session("FinancialDecisions"),
 Session("TransitionManagement"), _
Session("
OperationalManagement"), Session("ProjectManagement"),
Session("TimeManageme
nt"), Session("QualityFocus"), Session("MSWord"), Session("MSProject"),
Sess
ion("SMART"), Session("MSPowerpoint"), _
Session("
MSExcel"), Session("NMS"), Session("OperatingSystems"),
Session("Application
Integration"), Session("ApplicationDevelopment"),
Session("PortalDevelopment
"), Session("DesktopManagement"), _
Session("
EnterpriseDNA"), Session("DataCarriage"), Session("DataVPN"),
Session("Route
rs"), Session("Switches"), Session("ConvergedTechnologies"),
Session("VoiceC
arriage"), Session("PABX"), Session("KeySystems"), Session("IVR"), _
Session("
Firewalls"), Session("IDS"), Session("HIDS"), Session("ITSecurityVPN"),
Sess
ion("Consultancy"))
            Session("Result") = "The skills database has been updated
with t
he below details."
            'if setSkiilsIndex is not NULL, then take me to my receipt
page
            If Not IsDBNull(updateSkillsIndex) Then
                Response.Redirect("requestComplete.aspx")
            Else
                'lblMessage.Text = "Database Save Error, please contact
Mark
 Ussher!!!"
            End If
        Else
            Dim setSkillsIndex As DataSet =
myJobRequest.setSkills(Session("
Name"), Session("BadgeID"), Session("Division"), Session("Location"),
Sessio
n("Data"), Session("Voice"), Session("Converged"), Session("Security"),
Sess
ion("Hosting"), Session("ContactCentres"), Session("Infrastructure"), _
Session("
Applications"), Session("EMC"), Session("D2WProcess"),
Session("CostingSprea
dsheets"), Session("SalesProcess"), Session("TAS"),
Session("ManageRelations
hips"), Session("CustomerFocus"), _
Session("
CommunicationSkills"), Session("DefineBuyingCriteria"),
Session("DecisionMak
ing"), Session("IssueResolution"), Session("BidManagement"),
Session("Vendor
Management"), _
Session("
Proposals"), Session("Negotiation"), Session("Presentation"),
Session("Contr
actWriting"), Session("BusinessCaseWriting"),
Session("FinancialDecisions"),
 Session("TransitionManagement"), _
Session("
OperationalManagement"), Session("ProjectManagement"),
Session("TimeManageme
nt"), Session("QualityFocus"), Session("MSWord"), Session("MSProject"),
Sess
ion("SMART"), Session("MSPowerpoint"), _
Session("
MSExcel"), Session("NMS"), Session("OperatingSystems"),
Session("Application
Integration"), Session("ApplicationDevelopment"),
Session("PortalDevelopment
"), Session("DesktopManagement"), _
Session("
EnterpriseDNA"), Session("DataCarriage"), Session("DataVPN"),
Session("Route
rs"), Session("Switches"), Session("ConvergedTechnologies"),
Session("VoiceC
arriage"), Session("PABX"), Session("KeySystems"), Session("IVR"), _
Session("
Firewalls"), Session("IDS"), Session("HIDS"), Session("ITSecurityVPN"),
Sess
ion("Consultancy"))
            Session("Result") = "Your skills have been created in the
skills
 database."
            'if setSkiilsIndex is not NULL, then take me to my receipt
page
            If Not IsDBNull(setSkillsIndex) Then
                Response.Redirect("requestComplete.aspx")
            Else
                'lblMessage.Text = "Database Save Error, please contact
Mark
 Ussher!!!"
            End If
        End If
    End Sub
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Loading