DEBUG help, System.NullReferenceException
-
First off all, yes I have googled it, and its such a vauge error code, that lots of pages that come up, arent helping much, Here is the error
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: Line 70: } Line 71: string strWho = ""; Line 72: strWho="Welcome "+user.UserID+" you are logged in as "+user.Role+" the date and time is now"+DateTime.Now.ToShortTimeString()+", "+DateTime.Now.ToShortDateString()+"."; Line 73: Label2.Text = strWho; Line 74: Label2.Font.Bold = true; Source File: c:\dimhrs\helpdesk\userfeedback.aspx.cs Line: 72
and here is my page load.private void Page_Load(object sender, System.EventArgs e) { //strAdd=""; if(!IsPostBack) { Panel1.Visible=false; LoadGrid(); } string strWho = ""; strWho="Welcome "+user.UserID+" you are logged in as "+user.Role+" the date and time is now"+DateTime.Now.ToShortTimeString()+", "+DateTime.Now.ToShortDateString()+"."; Label2.Text = strWho; Label2.Font.Bold = true; user=(CUsers)Session["SessionUser"]; QCDate.Text= DateTime.Now.ToShortDateString()+" "+DateTime.Now.ToShortTimeString(); strAdd="; ["+user.UserID+" - Date: "+ QCDate.Text + "]: "; Review.Text=QCDate.Text.Insert(Review.Text.Length,strAdd); if(user.NeedActionHelp==true) { NeedAction.Enabled=true; } else { NeedAction.Enabled=false; if(Comments.Text!="" && NeedAction.Checked==false) { SJReview.Visible=true; } else if(Comments.Text=="" && NeedAction.Checked==false) { SJReview.Visible=false; } else { } } }
-
First off all, yes I have googled it, and its such a vauge error code, that lots of pages that come up, arent helping much, Here is the error
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: Line 70: } Line 71: string strWho = ""; Line 72: strWho="Welcome "+user.UserID+" you are logged in as "+user.Role+" the date and time is now"+DateTime.Now.ToShortTimeString()+", "+DateTime.Now.ToShortDateString()+"."; Line 73: Label2.Text = strWho; Line 74: Label2.Font.Bold = true; Source File: c:\dimhrs\helpdesk\userfeedback.aspx.cs Line: 72
and here is my page load.private void Page_Load(object sender, System.EventArgs e) { //strAdd=""; if(!IsPostBack) { Panel1.Visible=false; LoadGrid(); } string strWho = ""; strWho="Welcome "+user.UserID+" you are logged in as "+user.Role+" the date and time is now"+DateTime.Now.ToShortTimeString()+", "+DateTime.Now.ToShortDateString()+"."; Label2.Text = strWho; Label2.Font.Bold = true; user=(CUsers)Session["SessionUser"]; QCDate.Text= DateTime.Now.ToShortDateString()+" "+DateTime.Now.ToShortTimeString(); strAdd="; ["+user.UserID+" - Date: "+ QCDate.Text + "]: "; Review.Text=QCDate.Text.Insert(Review.Text.Length,strAdd); if(user.NeedActionHelp==true) { NeedAction.Enabled=true; } else { NeedAction.Enabled=false; if(Comments.Text!="" && NeedAction.Checked==false) { SJReview.Visible=true; } else if(Comments.Text=="" && NeedAction.Checked==false) { SJReview.Visible=false; } else { } } }
Ibuprofen wrote:
strWho="Welcome "+user.UserID+" you are logged in as "+user.Role+" the date and time is now"+DateTime.Now.ToShortTimeString()+", "+DateTime.Now.ToShortDateString()+".";
Looks like the error is to do with the object user. Get the value of the userid and role into a string, debug and check if its got to do with the object user.
string strUserID = user.UserID;
string strRole = user.Role;
strWho="Welcome "+strUserID+" you are logged in as "+strRole+" the date and time is now"+DateTime.Now.ToShortTimeString()+", "+DateTime.Now.ToShortDateString()+"."; -
Ibuprofen wrote:
strWho="Welcome "+user.UserID+" you are logged in as "+user.Role+" the date and time is now"+DateTime.Now.ToShortTimeString()+", "+DateTime.Now.ToShortDateString()+".";
Looks like the error is to do with the object user. Get the value of the userid and role into a string, debug and check if its got to do with the object user.
string strUserID = user.UserID;
string strRole = user.Role;
strWho="Welcome "+strUserID+" you are logged in as "+strRole+" the date and time is now"+DateTime.Now.ToShortTimeString()+", "+DateTime.Now.ToShortDateString()+".";Thanks! Just posting what came up next, I pretty sure I can fix this, just figure the more questions posted here, the better answer archieve we get. Here's the Error
Cannot find column [System.Web.UI.WebControls.TextBox]. 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.Data.EvaluateException: Cannot find column [System.Web.UI.WebControls.TextBox]. Source Error: Line 138: DataTable dt=ds.Tables[0]; Line 139: string filterExp="autoNum="+autoNum; Line 140: DataRow[] rowFound= dt.Select(filterExp); Line 141: foreach (DataRow dr in rowFound) Line 142: { Source File: c:\dimhrs\helpdesk\userfeedback.aspx.cs Line: 140
and the majority of the load recordprivate void LoadRecord(string recNumber) { LoadGrid(); Panel2.Visible=false; Panel1.Visible=true; DataTable dt=ds.Tables[0]; string filterExp="autoNum="+autoNum; DataRow[] rowFound= dt.Select(filterExp); foreach (DataRow dr in rowFound) { DateSubmit.Text=dr["DateSubmit"].ToString(); TicketNum.Text=dr["autoNum"].ToString(); SubmitBy.Text=dr["Name"].ToString();
-
Thanks! Just posting what came up next, I pretty sure I can fix this, just figure the more questions posted here, the better answer archieve we get. Here's the Error
Cannot find column [System.Web.UI.WebControls.TextBox]. 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.Data.EvaluateException: Cannot find column [System.Web.UI.WebControls.TextBox]. Source Error: Line 138: DataTable dt=ds.Tables[0]; Line 139: string filterExp="autoNum="+autoNum; Line 140: DataRow[] rowFound= dt.Select(filterExp); Line 141: foreach (DataRow dr in rowFound) Line 142: { Source File: c:\dimhrs\helpdesk\userfeedback.aspx.cs Line: 140
and the majority of the load recordprivate void LoadRecord(string recNumber) { LoadGrid(); Panel2.Visible=false; Panel1.Visible=true; DataTable dt=ds.Tables[0]; string filterExp="autoNum="+autoNum; DataRow[] rowFound= dt.Select(filterExp); foreach (DataRow dr in rowFound) { DateSubmit.Text=dr["DateSubmit"].ToString(); TicketNum.Text=dr["autoNum"].ToString(); SubmitBy.Text=dr["Name"].ToString();