Let me give you general idea for this scenario.
For that very reason pass value of
TextBox
( which states how many rows you want to retrieve from DB ) as a parameter to stored procedure
i.e.
exec dbo.Test 23
Now at the receiving side catch this parameter and set
ROWCOUNT
Accordingly.
i.e.
CREATE PROCEDURE Test
@rowscount int
AS
begin
SET ROWCOUNT @rowscount;
select * from Person.Address
end
Which will return you desired number of rows.
Hope that helps.
Please
vote and
Accept Answer if it Helped.