Home All Groups Group Topic Archive Search About

Using correctly SqlDataReader

Author
23 Jan 2006 3:27 PM
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

Author
23 Jan 2006 4:12 PM
john smith
Javier Martínez wrote:
> 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.
Author
23 Jan 2006 4:43 PM
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?

Show quote
"john smith" <j***@smith.com> escribió en el mensaje
news:Opj3SfDIGHA.3176@TK2MSFTNGP12.phx.gbl...
> Javier Martínez wrote:
>> 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.
Author
23 Jan 2006 5:43 PM
john smith
Javier Martínez wrote:
Show quote
> Thanks, then another question, when the sqldatareader is used by a
> datagridcontrol when the pagination is done?
> Is released the same query each request?
>
> "john smith" <j***@smith.com> escribió en el mensaje
> news:Opj3SfDIGHA.3176@TK2MSFTNGP12.phx.gbl...
>> Javier Martínez wrote:
>>> 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.
>
>
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 :)

AddThis Social Bookmark Button