473,830 Members | 2,095 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Get copy of cache item?

8 New Member
I am having a weird (to me at least) problem retrieving a copy of an item in the Cache.

I do something like this:
Expand|Select|Wrap|Line Numbers
  1. DataTable ToBeInserted = FunctionThatReturnsDataTable();
  2. Cache.Insert("CacheTable", ToBeInserted);
  3. public DataTable function()
  4. {
  5. DataTable Results = (DataTable)Cache[CacheTable];
  6. Results.Columns.Add("Rank");
  7. return Results;
  8. }
On the second time running the function, I get an exception that the column "Rank" is already part of the table.

Shouldn't "Results" be a new DataTable instance? I'm unintentionally adding the column to the Cached item. I just want a copy of the cached datatable to alter and return. When I run the function, I want to create the Results table all over again and modify it without altering the cached datatable.

Any ideas?
Aug 15 '07 #1
1 1201
ceestand
8 New Member
Anyone have a guess?

Bueller...?
Aug 15 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2933
by: Brian Vallelunga | last post by:
I'm having a problem using the Cache object with asp.net. Here is what I have: 1) I put something in cache and set its callback method. 2) The object times out after X minutes and calls the callback method specified. 3) The callback method gets the newest version of the item from the db and then calls a helper method to put the item back into cache. It looks like this: //Pseudocode
1
3187
by: Glenn | last post by:
Hi, I have a config XML file that I am using from the application cache. I have configured the entry with a remove callback to re-populate cache automatically when the XML file changes. All is well until the XML file is changed. The cached item is being removed as I would expect, but the remove callback is not firing at all, hence a NullReferenceException is being raised when I try to access the cache object. Please see code snippet...
0
1054
by: Aamir79 | last post by:
Hi all, I'm using Microsoft Applications cache block in my web application. It worked fine for sometime then suddenly it is raising the following error: Message: "Can't validate the current data item. Maybe it was altered." Source: "Microsoft.ApplicationBlocks.Cache" StackTrace: "at Microsoft.ApplicationBlocks.Cache.DataProtectionManager.RemoveMAC(Byte binaryMacValue) in
3
1703
by: Kyong Kwak | last post by:
Hey all my second post! wanted to know if I can cache an entire control.. this is what I have.. Webform has header, nav, footer, and Usercontrol_1. Usercontrol_1 has a datalist and paging items ( prev, current page, next ). I wanted to output cache for each "page" of the datalist, but I can't seem to get it to work ( any suggestions? ). It would only cache at the usercontrol level. so I'd get the header, nav, foot, and...
2
1766
by: Don | last post by:
I've come across a weird behaviour with regards to the cache object. I couldn't find any documentation which could explain this. Basically the problem has to do with the cache item NOT expiring. If you look at the below code, u'll see that i'm creating 2 cache items with the keys ONE and TWO. And both are set to expire in 30 seconds. When i click the button every time before 30 seconds, i can view the cache data.
5
2130
by: Stan SR | last post by:
Hi, Some newbie questions.. :-) First, what is the namespace to use for the Cache class ? When I use this bit of code I get an error if (Cache==null) Cache.Insert("myUserList",userlist); I don't know which namespace to use.
3
3066
by: poolieweb | last post by:
I have created a custom user control which creates a ASPxMenu ( Same fucntion as standard menu control) from data retreved from a webservice (Reporting Services) which deals with user access. This process is slow. And as the menu object will not change in a session I am trying to cache the menu with the session user as the key. The problem is that I can not retreve the menu object after the first request. The menu items are resident in the...
8
1426
by: brett | last post by:
How do I add a string to the cache so that it updates if the string source changes? CacheDependency() seems to want an absolute path. My string is a full http link. Thanks, Brett
2
3167
by: Peter | last post by:
Hi The documentation for System.Web.Caching.Cache states that it is "thread safe". Does this mean that if I access System.Web.Caching.Cache from several places in my application access to the items in the cache is synchronised so I don't get problems with setting/getting the same item at the same time?
0
9791
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10771
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10525
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10202
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7745
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6950
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5617
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4411
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3958
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.