locked
Server Error in '/' Application. RRS feed

  • Question

  • User1013200534 posted

    1) EmpId

    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.IndexOutOfRangeException: EmpId

    Source Error:

    Line 23:           {
    Line 24:               oEmpInfo = new EmpInfo();
    Line 25: oEmpInfo.EmpId = new Guid(rdrEmp[Constants.EmpId].ToString()); 
    Line 26: oEmpInfo.EmpName=Convert.ToString(rdrEmp[Constants.EmpName]); Line 27: oEmpInfo.EmpTitle = Convert.ToString(rdrEmp[Constants.EmpTitle]);


    2) Value cannot be null.
    Parameter name: g

       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.ArgumentNullException: Value cannot be null.
    Parameter name: g

    Source Error:

    Line 21:                 if (Request.QueryString[Constants.Mode] == Constants.EditMode)
    Line 22:                 {
    Line 23: Guid gdEmpId=new Guid(Request.QueryString[Constants.EmpId]); 
    Line 24: EmpOperation oEmpOperation = new EmpOperation(); Line 25: oEmpInfo = oEmpOperation.GetACEmpDetails(gdEmpId);
    Thursday, August 29, 2013 6:27 AM

Answers

  • User1013200534 posted

    Thanx guys.. my problem got solved... use the same code...

    just commented off this line = //oEmpInfo.EmpId = new Guid(rdrEmp[Constants.EmpId].ToString()); And both the error gone and its running... Thanx guys...

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 30, 2013 4:15 AM

All replies

  • User1013200534 posted

    How to Solve this two exception? Give me code and please explain me in simple language.. Thank you.

    Thursday, August 29, 2013 6:27 AM
  • User-306750178 posted

    Hi,

    Try below method.

    Guid.TryParse()

    or

    Guid.TryParseExact()

    Hope this will help you.

    Thursday, August 29, 2013 7:44 AM
  • User1013200534 posted

    Thank You !! but where to apply the code? I mean after which line?

    Thursday, August 29, 2013 8:15 AM
  • User-306750178 posted

    Replace at "new Guid()"

    Line 25: oEmpInfo.EmpId = new Guid(rdrEmp[Constants.EmpId].ToString()); 
    Line 23: Guid gdEmpId=new Guid(Request.QueryString[Constants.EmpId]);
    Thursday, August 29, 2013 8:38 AM
  • User1013200534 posted

    No Overload for method 'TryParse' takes 0 argument ----- Showing this Error in both places....

    Thursday, August 29, 2013 8:59 AM
  • User-306750178 posted

    Hi,

    Use as below.

    string empID = Request.QueryString[Constants.EmpId];
    Guid gdEmpId=new Guid();
    if(Guid.TryParse(empID, out gdEmpId))
     



    Thursday, August 29, 2013 9:10 AM
  • User-1716253493 posted
    Guid gdEmpId=new Guid(Request.QueryString["EmpId]"); 

    Thursday, August 29, 2013 9:39 PM
  • User1013200534 posted

    @ramu.net


    Not Happening..... tried UR code....

    Friday, August 30, 2013 1:32 AM
  • User1013200534 posted

    @oned_gk Same Error is Showing :

    Value cannot be null.
    Parameter name: g
    Friday, August 30, 2013 1:33 AM
  • User1013200534 posted

    Got Something interesting....

    if i use   oEmpInfo.EmpId = new Guid(rdrEmp[Constants.EmpId].ToString()); then its showing System.IndexOutOfRangeException: EmpId

    but if i use oEmpInfo.EmpId = new Guid("fd4477c3-586b-4373-9a76-6465dd924d2b"); then its totally working properly.... now plz tell me...

    Friday, August 30, 2013 2:36 AM
  • User-306750178 posted

    Hi,

    Try like below.

    string empID = rdrEmp[Constants.EmpId].ToString();
    oEmpInfo.EmpId = new Guid(empID)



    Friday, August 30, 2013 2:54 AM
  • User1013200534 posted

    @ramu.net same probs... System.IndexOutOfRangeException: EmpId Frown

    Friday, August 30, 2013 3:02 AM
  • User-306750178 posted

    Hi,

    Try this.

    string empID = string.Format("########-####-####-####-############", rdrEmp[Constants.EmpId].ToString());
    oEmpInfo.EmpId = new Guid(empID)

    May this work for you.

    Friday, August 30, 2013 3:11 AM
  • User1013200534 posted

    Thanx guys.. my problem got solved... use the same code...

    just commented off this line = //oEmpInfo.EmpId = new Guid(rdrEmp[Constants.EmpId].ToString()); And both the error gone and its running... Thanx guys...

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 30, 2013 4:15 AM