[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.caching

Problem When we change DataSet after caching

SMG

5/16/2005 7:41:00 AM

Hi All,
I am using caching on my page. The dataset is retrieved from the cache or
database as per the availability.
Once I get DataSet in my page from my BusinessComponent(A Different Project
which returns fresh / cached dataset),
I use that DataSet to bind with a DataList in a page, just before I bind it
to DataList I remove a row from DataSet and then bind it to datalist.

Now what is happening is If I remove the row from this DataSet, it is being
removed from Cached DataSet as well, why so?

The DataSet is cached in component and after that DataSet is modified on the
page.
The changes I make to DataSet in Page is reflecting the DataSet in Cached.


Why it is doing so? there is any problem with the code?

Code ==== as follows
objNews = new ShK.BusinessComponents.News();
DataSet ds = objNews.GetNewsHeadingsData();
dlReuterT.DataSource = ds;
dlReuterT.DataBind();
ds.Tables[0].Rows.RemoveAt(0);

Let me know if I am not clear here... .

Thanks And best regards,
Shailesh
Idealake Tech


3 Answers

Brock Allen

5/16/2005 11:05:00 PM

0

> The changes I make to DataSet in Page is reflecting the DataSet in
> Cached.

Because when you fetch the DataSet from the cache, you''re getting back a
reference to the DataSet (not a copy).

-Brock
DevelopMentor
http://staff.develop....



SMG

5/17/2005 12:38:00 PM

0


How do I overcome this,

Are you saying I should take a copy of that dataset and then put it in
cache? Don''t you think that will increase my memory utilization?

When I create cache object will it create cache object for each processor?

Regards,
Shailesh Gajare


"Brock Allen" <ballen@NOSPAMdevelop.com> wrote in message
news:744898632518563098294672@msnews.microsoft.com...
> The changes I make to DataSet in Page is reflecting the DataSet in
> Cached.

Because when you fetch the DataSet from the cache, you''re getting back a
reference to the DataSet (not a copy).

-Brock
DevelopMentor
http://staff.develop....


Brock Allen

5/17/2005 9:20:00 PM

0

You can either make a copy of the DataTable before data binding, but better
yet simply make an array of references to the DataRows you want shown. So
you''re not going to have a huge memory overhead in doing this.

You can also use a DataView to exclude the rows you don''t want shown. Check
out the DataView''s RowFilter property.

One last idea is to DataBind to all the rows in your DataTable then remove
the row from the DataSet you don''t want rendered.

-Brock
DevelopMentor
http://staff.develop....



> How do I overcome this,
>
> Are you saying I should take a copy of that dataset and then put it
> in cache? Don''t you think that will increase my memory utilization?
>
> When I create cache object will it create cache object for each
> processor?
>
> Regards,
> Shailesh Gajare
> "Brock Allen" <ballen@NOSPAMdevelop.com> wrote in message
> news:744898632518563098294672@msnews.microsoft.com...
>
>> The changes I make to DataSet in Page is reflecting the DataSet in
>> Cached.
>>
> Because when you fetch the DataSet from the cache, you''re getting back
> a reference to the DataSet (not a copy).
>
> -Brock
> DevelopMentor
> http://staff.develop....