I thought that I had replyed to your post yesterday, but for some reason, the post is not showing, so here it is again . . .
The sproc's developer chose to return TotalRecords as a second result set rather than as an output parameter. This seems to be the usual pattern used throughout the DNN core sprocs - probably so that the SqlDataProvider/DataProviders consistently return only an IDataReader. How TotalRecords is obtained from the second result set of the IDataReader can be seen in the controller class. Note the use of IDataReader.NextResult() to advance to the second result set. Here is a bit of code from the controller class of a module currently under development that follows this same pattern to obtain a paged set of records and the TotalRecords count:
Public Function GetRequests(ByVal ModuleID As Integer, ByVal Filter As String, ByVal OrderBy As String, ByVal UserID As Integer, _
ByVal PageSize As Integer, ByVal PageIndex As Integer, ByRef TotalRecords As Integer) As List(Of RequestInfo)
Dim dr As IDataReader = DataProvider.Instance().GetRequests(ModuleID, Filter, OrderBy, UserID, PageSize, PageIndex)
Dim objRequests As New List(Of RequestInfo)
If Not dr Is Nothing Then
Try
While dr.Read
objRequests.Add(FillRequest(dr, False))
End While
Try
dr.NextResult()
If dr.Read Then
TotalRecords = Convert.ToInt32(dr("TotalRecords"))
Else
TotalRecords = objRequests.Count
End If
Catch ex As Exception
TotalRecords = objRequests.Count
End Try
Finally
If Not dr.IsClosed Then dr.Close()
End Try
End If
Return objRequests
End Function
The FillRequest method is my custom hydrator for the RequestInfo class. For performance reasons, I prefer not to use CBO.FillObject.