Hi, This is the code I use to get parameter support. At the moment I must switch off friendly URLs in Host settings because I don’t yet know how to use NavigateURL. The changes are in App_Code\Reports\ReportsController.vb. This is for version 4.05 although it should work for 5 as well.
Regards Jaco Vosloo
Original:
Public Shared Function BuildParameters(ByVal SrcModule As PortalModuleBase) As DbParameter()
Return New SqlParameter() {BuildIntParam("@PortalID", SrcModule.PortalId), BuildIntParam("@TabID", SrcModule.TabId), _
BuildIntParam("@ModuleID", SrcModule.ModuleId), BuildIntParam("@UserID", SrcModule.UserId)}
End Function
New:
Public Shared Function BuildParameters(ByVal SrcModule As PortalModuleBase, ByVal Query As String) As DbParameter()
Dim tmpParameterName As String
Dim tmpArray As New ArrayList
Dim IndexStart, IndexEnd As Integer
IndexStart = Query.IndexOf("@", 0)
Do While IndexStart >= 0
IndexEnd = Query.IndexOf(" ", IndexStart)
If IndexEnd < 0 Then IndexEnd = Query.Length
tmpParameterName = Query.Substring(IndexStart + 1, IndexEnd - IndexStart - 1)
tmpArray.Add(BuildParameter(SrcModule, tmpParameterName))
IndexStart = Query.IndexOf("@", IndexEnd)
Loop
Return CType(tmpArray.ToArray(GetType(DbParameter)), DbParameter())
End Function
Private Shared Function BuildParameter(ByVal SrcModule As PortalModuleBase, ByVal ParameterName As String) As SqlParameter
Dim tmpValue As String
Dim tmpParameter As SqlParameter = Nothing
Dim thisrequest As HttpRequest = HttpContext.Current.Request
Dim AddBlankParameters As Boolean = True
Select Case ParameterName
Case "PortalID"
tmpParameter = BuildIntParam("@PortalID", SrcModule.PortalId)
Case "TabID"
tmpParameter = BuildIntParam("@TabID", SrcModule.TabId)
Case "ModuleID"
tmpParameter = BuildIntParam("@ModuleID", SrcModule.ModuleId)
Case "UserID"
tmpParameter = BuildIntParam("@UserID", SrcModule.UserId)
Case Else
tmpValue = thisrequest.Params(ParameterName)
If AddBlankParameters Or Not (tmpValue Is Nothing Or tmpValue = "") Then
tmpParameter = New SqlParameter("@" + ParameterName, tmpValue)
End If
End Select
Return tmpParameter
End Function