
Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net
Hi Mark,
I think maybe Andrew also want to utilize the declarative/codeless
databinding model of ASP.NET 2.0 to populate the controls with records
retrieved through datareader.
Hi Anderw,
I also think that using an objectDataSource here is not quite confortable
and convenient. Because if you use DataReader, your business object query
the DB and return datareader, the close/disposing code should also be
performed by the buisness object. However, during the databinding period,
the objectdatasource will use the datareader to perform databinding against
the target databound control. Thus, your business class has to determine
when to close/dispose the datareader(this is the question here...). Or you
can let the ObjectDatasource to close the DataReader(expose from your
business object through some public interface/methods).
So far, I think you can consider use the following event of
objectdatasource control:
#ObjectDataSource.ObjectDisposing Event
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdat
asource.objectdisposing.aspx
it can let you do some work before the ObjectDataSource disposing the
underlying business class object. You can get the assocated DataReader from
the object instance and close it at that time. How do you think?
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "Mark Rae [MVP]" <mark@markNOSPAMrae.net>
>References: <Ot62W0m5HHA.5980@TK2MSFTNGP04.phx.gbl>
<OjMl28m5HHA.980@TK2MSFTNGP06.phx.gbl>
<eH8Eu#m5HHA.5844@TK2MSFTNGP02.phx.gbl>
>In-Reply-To: <eH8Eu#m5HHA.5844@TK2MSFTNGP02.phx.gbl>
>Subject: Re: ASP.NET binding to DataReader
[quoted text clipped - 14 lines]
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>NNTP-Posting-Host: 82-45-166-9.cable.ubr06.hari.blueyonder.co.uk
82.45.166.9
>Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP02.phx.gbl
>Xref: TK2MSFTNGHUB02.phx.gbl microsoft.public.dotnet.framework.aspnet:39736
[quoted text clipped - 4 lines]
>
>If you have a DAL, the data controls are completely unnecessary...
Mark Rae [MVP] - 27 Aug 2007 09:36 GMT
> I think maybe Andrew also want to utilize the declarative/codeless
> databinding model of ASP.NET 2.0 to populate the controls with records
> retrieved through datareader.
Hmm, maybe... Seems like a totally unnecessary step to me...
Also, your replies appear to be including the full headers of the post
you're replying to...

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net
Steven Cheng[MSFT] - 27 Aug 2007 11:28 GMT
Thanks Mark,
yes...... it seems a tool issue, I'll take care and manually remove those
headers next time..... :)
Thanks for your care.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "Mark Rae [MVP]" <mark@markNOSPAMrae.net>
>References: <Ot62W0m5HHA.5980@TK2MSFTNGP04.phx.gbl>
<OjMl28m5HHA.980@TK2MSFTNGP06.phx.gbl>
<eH8Eu#m5HHA.5844@TK2MSFTNGP02.phx.gbl>
<#O38ryo5HHA.1164@TK2MSFTNGP02.phx.gbl>
<OoifR0F6HHA.5608@TK2MSFTNGHUB02.phx.gbl>
>In-Reply-To: <OoifR0F6HHA.5608@TK2MSFTNGHUB02.phx.gbl>
>Subject: Re: ASP.NET binding to DataReader
[quoted text clipped - 14 lines]
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>NNTP-Posting-Host: 82-45-166-9.cable.ubr06.hari.blueyonder.co.uk
82.45.166.9
>Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP06.phx.gbl
>Xref: TK2MSFTNGHUB02.phx.gbl microsoft.public.dotnet.framework.aspnet:39867
[quoted text clipped - 8 lines]
>Also, your replies appear to be including the full headers of the post
>you're replying to...
Andrew Robinson - 28 Aug 2007 04:39 GMT
Steve,
Thanks for the info. I will look into the object disposing event on the ODS.
-A
> Thanks Mark,
>
[quoted text clipped - 51 lines]
>>Also, your replies appear to be including the full headers of the post
>>you're replying to...
Steven Cheng[MSFT] - 28 Aug 2007 05:08 GMT
No problem. If you have any further question, welcome to continue discuss
here.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "Andrew Robinson" <nemoby@nospam.nospam>
>
[quoted text clipped - 59 lines]
>>>Also, your replies appear to be including the full headers of the post
>>>you're replying to...