Hi,
I have an objectdatasource with a selectmethod. that method then calls a stored procedure and creates a datatable that gets sent back to the objectdatasource. My problem is that even though I have a output paramater on the objectdatasource it doesn't receive a value.
Here is the code, any healp is appreciated.
Stored Proc
Code:
ALTER PROCEDURE [dbo].[GetPagedWines]
@PageIndex INT,
@NumRows INT,
@TotalCount INT OUTPUT
AS
BEGIN
SELECT @TotalCount = 150 /*(SELECT COUNT(*) FROM Wine AS TotalCount)*/
DECLARE @StartRowIndex INT;
SET @StartRowIndex = (@PageIndex * @NumRows) + 1;
WITH ListEntries AS (
SELECT ROW_NUMBER() OVER (ORDER BY WineID_PK ASC)AS Row, * FROM Wine)
SELECT *, @TotalCount AS TotalCount
FROM ListEntries
WHERE Row between @StartRowIndex and @StartRowIndex+@NumRows
RETURN
END
objectdatasource
Code:
<asp:ObjectDataSource ID="odsWineList" runat="server" TypeName="BLL.WineFunctions.WinesBLL" SelectMethod="GetPagedWinesBLL">
<SelectParameters>
<asp:Parameter Name="PageIndex" DefaultValue="0" />
<asp:Parameter Name="numRows" DefaultValue="10" />
<asp:Parameter Name="TotalCount" Direction="Output" DefaultValue="0"/>
</SelectParameters>
</asp:ObjectDataSource>
Code:
Public Function GetPagedWinesBLL(ByVal numRows As Integer, ByVal PageIndex As Integer, ByVal TotalCount As Integer) As Wines.WinesDataTable
Return Adapter.GetAllWinesPaged(PageIndex, (numRows - 1), TotalCount)
End Function