Bill,
I am creating a stored procedure to use in a grid where I can specify the number of rows to display and which page to display (as well as other filters). I am trying to create a stored procedure that returns the total number of rows that match all filters except the paging filters. Some of my filters are somewhat complex and I didn't want to include those in a second Stored Procedure. ADO.NET returns the number of rows affected without any explicit logic.
>Hi Mike,
>
>It may not fill your need, but I usually return the rows affected as an OUTPUT parameter from the stored proc.
>
>Bill
>
>>>Is this possible? I am working on setting up paging on a form and I don't want to duplicate the joins and filters in a second query that just returns the count. I've seen an example of creating a temp table and inserting the results of a stored procedure into that table but I wanted to see if there was an easier way.
>>
>>
>>FYI, I found the following example elsewhere that does exactly what I want to do:
>>
>>
>>EXEC dbo.sp_get_stuff;
>>SELECT @@Rowcount;
>>
>>
>>The only issue is that it returns both the resultset and the rowcount where I would like to return only the rowcount. It does allow me to only have the complex logic of the sp_get_stuff Stored Proc in one place instead of two.