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


Please Help Members By Posting Answers For Below Questions

What is datasource in ado.net?

588


Explain what are the steps to connect to a database?

497


What is command class in ado.net?

475


What is acid in ado.net?

531


What are all components of ADO.Net data provider?

609






What is a datareader object?

579


What are the parameters that control most of connection pooling behaviours?

574


What are the steps to connect to a database?

546


What is csdl entity framework?

555


What is sqlconnection and sqlcommand?

519


What is namespace in ado.net?

498


What are the advantages of oledb compared with other classes?

2321


How many major types of connection objects in ADO.NET?

592


What is the difference between OLEDB Provider and SqlClient?

526


How to retrieve the user id which is provided while windows authentication?

590