Click here to Skip to main content
16,017,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I need a help regarding cache.
I am making a database call which is returning an XML. Take example as below
XML
<root>
  <Emp id="m1" text="Test1" />
  <Emp id="m2" text="Test2">
    <Emp id="m2-1" text="Test3">
      <Emp id="m2-11" text="Test4" />
      <Emp id="m2-12" text="Test5" />
      <Emp id="m2-13" text="Test6" />
      <Emp id="m2-14" text="Test7" />
    </Emp >
</root>

I want to cache all the data from XML and while retrieving the data i want to retrieve on the basis of "id". for example I need text of id "m2-1".

Please help me on how to cache the data and retrieve it in c#.

Thanks in advance

Riya
Posted
Updated 5-May-12 8:46am
v2
Comments
Sandeep Mewara 5-May-12 14:47pm    
ASP.NET right?
Riyachaterjee 5-May-12 15:32pm    
yes

1 solution

Here is simple steps how to do so. I'm assuming you are try to cache it in a Web(ASP.NET) application.
1.Load the data(xml) using ADO.Net dataset.How To Read XML Data into a DataSet by Using Visual C# .NET[^] (Optional)
2.Insert the loaded data into cache object.ASP.NET Caching: Techniques and Best Practices[^].

Note: Step 1 is optional. You can cache the xml file with out dataset.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900