Joem Orcullo

Joem Orcullo

  • NA
  • 10
  • 14.7k

There is no row at position 0. (Deployed on IIS)

May 3 2016 6:17 PM
Hi guys can you help me on this one, I'm only having this error when my site is deployed on IIS
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:

[IndexOutOfRangeException: There is no row at position 0.]    
System.Data.RBTree`1.GetNodeByIndex(Int32 userIndex) +1556386    
System.Data.DataRowCollection.get_Item(Int32 index) +20    
HRMS.Index.Page_Load(Object sender, EventArgs e) in 
C:\Users\orculloj\Desktop\New folder (2)\HRMS\HRMS\Index.aspx.vb:83    
System.Web.UI.Control.OnLoad(EventArgs e) +92    
System.Web.UI.Control.LoadRecursive() +54    
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, 
Boolean includeStagesAfterAsyncPoint) +772 
 
HERE IS MY PAGE_LOAD CODE:
 
 
  1. Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load  
  2.   
  3.         Dim DomainUser As String = System.Web.HttpContext.Current.User.Identity.Name.Replace("\", "/")  
  4.         'Dim DomainUser As String = System.Security.Principal.WindowsIdentity.GetCurrent.Name.Replace("\", "/")  
  5.   
  6.         Dim sUser() As String = Split(DomainUser, "/")  
  7.         Dim sUserId As String = ""  
  8.         'Dim sDomain As String = sUser(0)  
  9.         If DomainUser <> "" Then  
  10.             sUserId = sUser(1)  
  11.         End If  
  12.   
  13.         pubUser = sUserId  
  14.   
  15.         'pubUser = "ricerrae"  
  16.   
  17.         userID.Text = pubUser  
  18.   
  19.         'UpdateUserStatusTemp()  
  20.   
  21.         GetEmpInfo()  
  22.         LastLeave()  
  23.         PopulateHolidays(Val(lblMonth.Text))  
  24.   
  25.         If Not Page.IsPostBack Then  
  26.             If dtEmp.Rows.Count > 0 Then  
  27.                 employeeID = dtEmp.Rows(0)("EmpID")  
  28.                 employeeName = dtEmp.Rows(0)("EmpName")  
  29.                 employeeSupervisor = dtEmp.Rows(0)("MngrName")  
  30.                 employeeDepartment = dtEmp.Rows(0)("LOBDesc")  
  31.                 employeeLocation = dtEmp.Rows(0)("Location")  
  32.                 employeeDoj = CDate(dtEmp.Rows(0)("DateJoined")).ToString("MMMM dd, yyyy")  
  33.                 employeeApprover = dtEmp.Rows(0)("MngrName")  
  34.   
  35.                 empID.Text = employeeID  
  36.                 empName.Text = employeeName  
  37.                 supervisor.Text = employeeSupervisor  
  38.                 dept.Text = employeeDepartment  
  39.                 doj.Text = employeeDoj  
  40.                 approver.Text = employeeApprover  
  41.             End If  
  42.               
  43.             PopulateHolidays(Today.Month)  
  44.   
  45.             If dtHoliday_reg.Rows.Count > 0 Then  
  46.                 lblMonth.Text = Today.Month  
  47.   
  48.                 lblLeaveBal.Text = IIf(IsDBNull(dtEmp.Rows(0)("LeaveBal")), "00", dtEmp.Rows(0)("leaveBal"))  
  49.   
  50.             End If  
  51.               
  52.             If dtChkLeave.Rows.Count > 0 Then  
  53.                 lblLastLeave.Text = dtChkLeave.Rows(0)("LastLeave")  
  54.             End If  
  55.   
  56.         End If  
  57.     End Sub  
 
PS: as you would notice, my code is in vb and i know this is a c# forum, so ill just convert my code or your answer. THANKS

Answers (3)