Server Error in '/' 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:


Line 32:             SqlCommand cmd = new SqlCommand("SELECT dpt_title  FROM DEPARTMENT INNER JOIN DOCTOR  on dpt_id=dc_dept_id WHERE dc_id=" + Convert.ToInt32(Page.RouteData.Values["prfId"]), con);
Line 33:             con.Open();
Line 34:             Literal2.Text = Literal2.Text = cmd.ExecuteScalar().ToString();
Line 35:             con.Close();
Line 36:             //drpDept.SelectedValue = Page.RouteData.Values["dptId"].ToString();

Source File: d:\inetpub\vhosts\nationalhospitals.com\httpdocs\MedicalTeam\Details.aspx.cs    Line: 34

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   MedicalTeam_Details.Page_Load(Object sender, EventArgs e) in d:\inetpub\vhosts\nationalhospitals.com\httpdocs\MedicalTeam\Details.aspx.cs:34
   System.Web.UI.Control.OnLoad(EventArgs e) +105
   System.Web.UI.Control.LoadRecursive() +67
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3784


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.4069.0