473,326 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Datareader question

I have a question related to DataReader

Suppose a lot of the data is being retrieved from database. To make
use of the advantage of datareader over dataset this data should be
transferred in HttpResponse to the user that request the site. Is this
possible that the data will display to the user as datareader reads
them from database?

Regards
Piotr Kołodziej
Dec 18 '07 #1
4 1435
Liz

<<
"Piotrekk" <Pi*************@gmail.comwrote in message
news:42**********************************@i29g2000 prf.googlegroups.com...
I have a question related to DataReader

Suppose a lot of the data is being retrieved from database. To make
use of the advantage of datareader over dataset this data should be
transferred in HttpResponse to the user that request the site. Is this
possible that the data will display to the user as datareader reads
them from database?

Regards
Piotr Kołodziej
>>

while (reader.Read())
{
Response.Write( reader[0].ToString());
}

I haven't run that but I should think it would do what you're asking ...
Dec 18 '07 #2
You are typically not going to see much difference here because usually the
data is used to bind to some sort of display control first such as a
GridView, Repeater, DataList. The control would have the CSS style
properties, colors and so on to provide a nice display vs. just streaming out
pieces of HTML into the Response stream.

The slight additional overhead of using a DataSet vs. a DataReader gives you
the flexibility to do sorting and filtering, as well as paging.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
"Piotrekk" wrote:
I have a question related to DataReader

Suppose a lot of the data is being retrieved from database. To make
use of the advantage of datareader over dataset this data should be
transferred in HttpResponse to the user that request the site. Is this
possible that the data will display to the user as datareader reads
them from database?

Regards
Piotr Kołodziej
Dec 18 '07 #3
Piotrekk wrote:
I have a question related to DataReader

Suppose a lot of the data is being retrieved from database. To make
use of the advantage of datareader over dataset this data should be
transferred in HttpResponse to the user that request the site. Is this
possible that the data will display to the user as datareader reads
them from database?
Are you asking that if you use a data reader and start writing
to response (ASP.NET !) whether the browser will start display
the first data before you have written the last data ?

(I think the answer is no, but you should get an answer from
a more ASP.NET knowledgable person than me)

Arne
Dec 19 '07 #4
For most web pages it is largely academic. As others have noted you
are likely to want to format etc - plus the data volumes on a typical
web page are small enough not to matter.

This might, however, be useful for "handler" implementations, such as
file exports. If you disable buffering you can output to the response
as you have it:

public class MyHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.Buffer = false;
int pause; // can specify the throttle at the query-string
int.TryParse(context.Request["foo"], out pause);
context.Response.ContentType = "text/plain";
context.Response.AddHeader("content-disposition",
"attachment; filename=bar.csv");
TextWriter tw = context.Response.Output;
for (int i = 0; i < 100000; i++)
{
tw.WriteLine(i);
Thread.Sleep(pause); // fake some slowness
}
context.Response.Close();
}

public bool IsReusable{get {return true;}}
}
Dec 19 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Thomas Scheiderich | last post by:
I have 2 dropdowns that are exactly the same and I don't want to re-read for each. Is there a way to do something like below where I read the data, bind to depCity1 and then bind to destCity2. ...
16
by: Thomas Scheiderich | last post by:
I have 2 dropdowns that are exactly the same and I don't want to re-read for each. Is there a way to do something like below where I read the data, bind to depCity1 and then bind to destCity2. ...
20
by: Mark | last post by:
Hi all, quick question , a DataView is memory resident "view" of data in a data table therefore once populated you can close the connection to the database. Garbage collection can then be used to...
7
by: Varangian | last post by:
Hi all, the question I want to ask if the conversion of a DataReader to a Table looping through the DataReader is better than using the Fill Method of the DataAdapter... I'm asking because...
20
by: fniles | last post by:
I am using VB.NET 2003, SQL 2000, and SqlDataReader. As I read data from tblA, I want to populate tblB. I use SQLDataReader for both tables. I do not use thread. When I ExecuteReader on tblB, I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shćllîpôpď 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.