Using correctly SqlDataReader

J

Javier Martínez

Hi
When I using a SqlDataReader returned by a ExecuteReader command is all data
results loaded in memory or the database is accessed in each Read method of
SqldataReader?
Thanks in advance
Javier
 
J

john smith

Javier said:
Hi
When I using a SqlDataReader returned by a ExecuteReader command is all data
results loaded in memory or the database is accessed in each Read method of
SqldataReader?
Thanks in advance
Javier
It is accessed as you read.
 
J

Javier Martínez

Thanks, then another question, when the sqldatareader is used by a
datagridcontrol when the pagination is done?
Is released the same query each request?
 
J

john smith

Javier said:
Thanks, then another question, when the sqldatareader is used by a
datagridcontrol when the pagination is done?
Is released the same query each request?
Pagination for GridViews and DataGrids is done after getting all the
results, on every single page request (same using Datsets, it pulls ALL
the matching records regardless, on every page load). The only way
around that is custom paging, using some fancy SQL to return only the
rows you want (either using temp tables, or nested queries, etc). There
are tons of articles about this, google is your friend :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top