Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question on this Paging Solution to Datalist...

Status
Not open for further replies.

satchi

Programmer
Sep 15, 2003
104
US
Hi, I have a question regarding this solution posted by a fellow poster DotNetGnat on these forums.


This seems like a great solution to accessing paging in datalists and it works, but it seems each time you look at another page, the sqldatabase needs to be opened, data grabbed, and closed.

My question is: is this the usual method of paging (GridView-built in paging, Datalists-custom paging)? I'm a little concerned about efficiency and was wondering if all paging opens and closes a database like that?

thanks..
 
That's not a bad solution for tables with fewer than a few thousand rows. Opening/closing on each request isn't a performance hog as long as you make sure to make use of the connection pool (basically, make sure the connection string is identical from request to request).

If you have more than a few thousand rows, you'll want to be more sophisticated about returning rows from the SQL query -- you'll need to supply some key information to help the database return fewer rows.

One big (huge!) gotcha in the original code is that there's no ORDER BY statement on the query. Not all databases will return rows in the same order for the same query execution, so the visitor will likely see dupes, as well as skips, when they page forward through the data.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top