Using correctly SqlDataReader

  • Thread starter Thread starter Javier Martínez
  • Start date Start date
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
 
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.
 
Thanks, then another question, when the sqldatareader is used by a
datagridcontrol when the pagination is done?
Is released the same query each request?
 
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 :)
 
Back
Top