If a table contains 20000 records . In a page at each time
100 records to be displayed. What are the steps u will take
to improve performance? will you use dataset or datareader?
Answer Posted / renjith t n
You need to look at ROW_NUMBER() to do this effectively.
Temp tables, cursors are to costly.
CREATE PROCEDURE myProc
@StartIndex INT
@MaxRecords INT
AS
SET @StartIndex = @StartIndex + 1
SELECT
first_name,
last_name,
middle_init
FROM
(SELECT
first_name,
last_name,
middle_init
ROW_NUMBER() OVER(ORDER BY last_name)
AS rownum
FROM
Users)
AS Users
WHERE
rownum between @StartIndex and (@StartIndex + @MaxRecords) -
1
Then we can use Dataset for best performance..
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What are dcl commands?
Which keyword is used to accept variable number of parameters?
How to find the given query is optimised one or not?
What is ole word?
What is read only and forward only in ado.net?
Explain the advantages and disadvantages of using datalist?
What are the steps to connect to a database?
What do you know about ADO.NET's objects and methods?
How do I delete a row from a DataTable?
Explain executenonquery?
Which one of the following objects is a high-level abstraction of the connection and command objects in ado.net?
What is ado.net objects?
What is defaultview in datatable?
Which object holds only data and does not interact with data source?
Can we do database operations without using any of the ado.net objects?