I need to display something like "Results x-y of z." The problem is, I can't figure out how to get the right value for z.
I am using SqlDataAdapter and Fill()ing a DataSet with subset x through y of the result set. How can I get the right value for z?
You are going to have to query the database to get the record number.
Select Count(OneOfYourFields) from YourTable.
You can command.executescalar to get the result
Thank you for the reply.
I am using a Stored Procedure, so this makes things a bit more complicated. I know with MySQL you can use mysql_num_rows() to fetch the number of rows a query will return, without actually grabbing all the data from that query and pulling it onto the web server. Is there any similar functionality in C#/ASP.NET?
Hi,
As far as I know, we cannot run COUNT() on the result set of a stored procedure. The only way I think is to add some SELECT COUNT(*) for each table in the stored procedure and return the count as OUTPUT parameters.
No comments:
Post a Comment