Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Working with Xml in Asp.Net C# 2008

Posted on 2008-06-20
4
Medium Priority
?
488 Views
Last Modified: 2008-11-21
What are the advantages of storing data in Xml file over database like Sql server 2005? And how to access xml file's data in asp.net C# 2008?
0
Comment
Question by:ShreyaTrivedi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 21

Accepted Solution

by:
naspinski earned 1000 total points
ID: 21830121
It (xml) really is just a different way to access your data.  It can be a bit more cumbersome if you are well versed in SQL, but even that is changing with LINQ (becoming a lot easier).

To me the main advantage of using XML is pure portability and no need for a SQL server.  You just move the files along with your program and you are good to go.  No install of anything.

On the other hand, for very large datasets, sql will be faster.  But for smaller (but still pretty big) sets, you will not even notice a difference and xml is sometimes even faster (cuts out a transport layer).

As I said, accessing XML has become much easier in the recent past.  Here is an example where I am getting all the parent elements which have a descendant of "categoryName".  The syntax might seem a little strange, but it is very simple once you get used to it.  This is using linq:
//C#
XElement x = XElement.Load(Server.MapPath(".") + "\\App_Data\\offers.xml");//get your file
//grab your categories
var AllOfferDetails = from p in (from q in x.Descendants("CategoryName") select q) where p.Value.Equals("No Annual Fee") select p.Parent.Parent;

Open in new window

0
 
LVL 21

Expert Comment

by:naspinski
ID: 21830133
I meant to say that in that example above it is getting the parents of all the CategoryName elements which the value is "no annual fee"
0
 

Author Comment

by:ShreyaTrivedi
ID: 21832019
I am totally new to Xml. So I wanted your help in -
I am making a ShareMarket web application.
I have a table containing clients information (ClientMaster). For each client (record), I have to maintain a table which will contain the scrips selected by him. I have thought of using xml for maintaing this table of scrips. So whenever I generate any report, I have to first check whether the scrips generated in report belong to the table of scrips corresponding to that client.
What should be the structure and how should I work with xml in this case?
And can I use Sql and Xml together ? I mean in my case, I will storing clients information in a table of sql and then can I store the scrips for the clients in xml?
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question