I am getting this exception in Server:
"Index was outside the bounds of the array."
[IndexOutOfRangeException: Index was outside the bounds of the array.]
pcdirectory.facultyPage.Page_Load(Object sender, EventArgs e) +2340
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
But while running code in local I don't get any exception or error. Any idea what would be causing this?
Here is the copy of code for Page_Load method:
Sub Page_Load(sender As Object, e As EventArgs)
if not isPostBack then
dim smsDBConnection as new SqlConnection(AppSettings("smsDBconnection"))
dim SQL as new stringBuilder()
dim command as new sqlCommand()
dim reader as sqldataReader
dim directoryGlobal as new directoryGloablFunctions()
try
command.connection = smsDBConnection
command.commandType = commandType.storedProcedure
smsDBConnection.open()
SQL.append("get_all_Numbers")
command.commandText = SQL.toString()
reader = command.executeReader()
drpClass.datasource = reader
drpClass.dataTextField = "Number"
drpClass.dataValueField = "Number"
drpClass.dataBind()
catch ex as exception
directoryGlobal.sendErrorMessageEmail(ex.message,SQL.toString(),ex.stackTrace,"DIRECTORY ERROR")
directoryGlobal.messageBox("An error has occurred on this page and been reported to the administrator." & vbcrlf & "Please try again later or contact technical support",me)
smsDBConnection.close()
end try
smsDBconnection.Close()
end if
end sub