Re: Does a Data Adapter Open() the connection automatically?
- From: "William \(Bill\) Vaughn" <billvaRemoveThis@xxxxxxxxxx>
- Date: Thu, 15 Sep 2005 12:12:38 -0700
Ah, not really. The DataReader is the low-level data stream used by the Fill
method to fetch the rowset. It is RO/FO and can't be used to "scroll"
through the rowset returned by the query. The Fill populates one or more
DataTable instances within a DataSet--one for each rowset returned by the
query. All you can do with a DataReader in an ASP application is use it to
populate a bound control (like a grid or textbox) or access the individual
rows and columns one-by-one.
hth
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
"Chris Y" <chris@xxxxxxxxxxxxx> wrote in message
news:OeMZsphuFHA.2960@xxxxxxxxxxxxxxxxxxxxxxx
> Thanks all. I think I understand better now. Correct me if I do not get
> this correctly: a DataSet is useful if I have complicated operations to be
> conducted on a complicated query. If it is a simple read and just paging
> back and forth I am better off with a DataReader?
>
> Chris
>
> "William (Bill) Vaughn" <billvaRemoveThis@xxxxxxxxxx> wrote in message
> news:Oy%23nz$guFHA.1264@xxxxxxxxxxxxxxxxxxxxxxx
>> Ah, it's mentioned in my book ;) and in Rob MacDonald's book on ASP
>> programming.
>> The DataSet is feature-rich--that's how it helps performance. It can
>> (does) also reduces the amount of code you have to write to support a
>> host of features that many applications need once the data is retrieved.
>> Yes, you have to persist it (yourself) in the Session state or elsewhere
>> as it's lost along with everything else not nailed down when the page
>> returns to the user.
>>
>> --
>> ____________________________________
>> William (Bill) Vaughn
>> Author, Mentor, Consultant
>> Microsoft MVP
>> www.betav.com/blog/billva
>> www.betav.com
>> Please reply only to the newsgroup so that others can benefit.
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> __________________________________
>>
>> "Chris Y" <chris@xxxxxxxxxxxxx> wrote in message
>> news:OQjC0AduFHA.3756@xxxxxxxxxxxxxxxxxxxxxxx
>>> Thanks Bill. Funny it is not mentioned at all in the docs.
>>>
>>> My next question is: how would a DataSet enhance performance? I am new
>>> to ASP.NET. I assume that it is still a stateless paradigm although I
>>> sense that the architecture is trying to make it pseudo stateful for
>>> developers. If a connection is closed everytime, wouldn't every piece of
>>> data have to be retrived all over again on the PostBack? Is there any
>>> available literature on this?
>>>
>>> Thanks.
>>>
>>> "William (Bill) Vaughn" <billvaRemoveThis@xxxxxxxxxx> wrote in message
>>> news:OgboUTbuFHA.3188@xxxxxxxxxxxxxxxxxxxxxxx
>>>> The Fill opens and closes the connection (as long as it's closed
>>>> beforehand).
>>>>
>>>>
>>>> --
>>>> ____________________________________
>>>> William (Bill) Vaughn
>>>> Author, Mentor, Consultant
>>>> Microsoft MVP
>>>> www.betav.com/blog/billva
>>>> www.betav.com
>>>> Please reply only to the newsgroup so that others can benefit.
>>>> This posting is provided "AS IS" with no warranties, and confers no
>>>> rights.
>>>> __________________________________
>>>>
>>>> "Chris Y" <chris@xxxxxxxxxxxxx> wrote in message
>>>> news:%23SV$XFbuFHA.1472@xxxxxxxxxxxxxxxxxxxxxxx
>>>>> and Close() it too?
>>>>>
>>>>> Thanks
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
.
- Follow-Ups:
- References:
- Does a Data Adapter Open() the connection automatically?
- From: Chris Y
- Re: Does a Data Adapter Open() the connection automatically?
- From: William \(Bill\) Vaughn
- Re: Does a Data Adapter Open() the connection automatically?
- From: Chris Y
- Re: Does a Data Adapter Open() the connection automatically?
- From: Chris Y
- Does a Data Adapter Open() the connection automatically?
- Prev by Date: RE: UPDATE command with @ variables
- Next by Date: Re: Does a Data Adapter Open() the connection automatically?
- Previous by thread: Re: Does a Data Adapter Open() the connection automatically?
- Next by thread: Re: Does a Data Adapter Open() the connection automatically?
- Index(es):
Relevant Pages
|