Conversion to Hashtable or other
-
Here's my code: Shared offset As Integer Public Function GetPN(reset As Boolean, pagenumber As Integer) As Integer If reset offset = pagenumber - 1 End If Return pagenumber - offset End Function This is for a report page number reset on a new grouping value. Since the offset must be shared (so that this will work across multiple callbacks to the server), if more than one person runs the report at the same time they’ll smash each other. I need to modify the offset to be a hashtable, and am not sure how I would.....or if there's another possible route. Thanks!
-
Here's my code: Shared offset As Integer Public Function GetPN(reset As Boolean, pagenumber As Integer) As Integer If reset offset = pagenumber - 1 End If Return pagenumber - offset End Function This is for a report page number reset on a new grouping value. Since the offset must be shared (so that this will work across multiple callbacks to the server), if more than one person runs the report at the same time they’ll smash each other. I need to modify the offset to be a hashtable, and am not sure how I would.....or if there's another possible route. Thanks!
-
Not sure where I'm going wrong, or really how to go about this, but here's what I have so far. I'm still a little new to session objects. I'm getting: Expression is not an array or method, and cannot have an arguement list. Shared offset As Integer Public Function GetPN(ByVal reset As Boolean, ByVal pagenumber As Integer) As Integer If reset Then offset(Session("report")) = pagenumber - 1 End If Return pagenumber - offset End Function Thanks!
-
Not sure where I'm going wrong, or really how to go about this, but here's what I have so far. I'm still a little new to session objects. I'm getting: Expression is not an array or method, and cannot have an arguement list. Shared offset As Integer Public Function GetPN(ByVal reset As Boolean, ByVal pagenumber As Integer) As Integer If reset Then offset(Session("report")) = pagenumber - 1 End If Return pagenumber - offset End Function Thanks!
Remove the static variable. It's not thread safe, so it won't work.
Public Function GetPN(ByVal reset As Boolean, ByVal pagenumber As Integer) As Integer
If reset Then
Session("report") = pagenumber - 1
End If
Return pagenumber - Session("report")
End Function--- b { font-weight: normal; }