Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 63757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:40:57+00:00 2026-05-10T18:40:57+00:00

Here is the story. I was doing a program, every time the program is

  • 0

Here is the story. I was doing a program, every time the program is closed all the data(File links) created by the user is lost, so whenever the user reopen the program, he does have to do all the work again.

So I decided to use an xml file to store the data, because a dbms would take too long to load and code to handle a plain text file would be hard to maintain.

The data is mainly composed of Links that stores two file paths, one for the origin and one for the destination, one boolean that represent the state of the link before the program is closed, and a few other less important things.

When the program loads the data should be read restoring the previous state of the application.

So I made a xml file like this:

...   <Directories>     <Directory id='0'>       <FilePath>C:\Test1</FilePath>       <PathSeparator>\</PathSeparator>     </Directory> ... 

And used a DataSet to get the data.

Directory getDirectory() {     ds = new DataSet();                 ds.ReadXml(xmlPath);     DataRow[] myRow = ds.Tables['Directory'].                 Select('id ='+id.ToString());// 'id = id'     string temp = myRow[0]['FilePath'].ToString();     Directory result = new Directory();     result.path = temp;     temp = myRow[0]['PathSeparator'].ToString();     result.pathSeparator = temp[0];     return result; } 

All that works just fine, but then I tried to add new ‘rows’ to the xml:

public static int addDirectory(DataSet ds, char pathSeparator, string path) {     DataRow myRow = ds.Tables['Directory'].NewRow();     myRow.ItemArray[0] = 8;     myRow.ItemArray[1] = path;     myRow.ItemArray[2] = pathSeparator.ToString();     myRow.ItemArray[3] = 'lol';     ds.Tables['Directory'].Rows.Add(myRow);     ds.AcceptChanges();     ds.WriteXml(ApplicationDataManager.xmlPath);     return 8; } 

But all this writes is to a random place on the .xml

What am I doing wrong?

By the way if anyone have any suggestions about how I should store that data, I would be glad to hear(read).

Thanks in advance!

[Update] File Links are used to create a connection between two directories, so they can be synchronized.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T18:40:58+00:00Added an answer on May 10, 2026 at 6:40 pm

    If LINQ is in your toolbox, I would highly recommend using that to read/write xml as opposed to a DataTable. It’s much more fluent and intuitive and you can control where the nodes go… wherever you add them to the collection is where they appear in the resulting XML.

    Here’s a quick intro and there’s a metric ton of information out there on the web about it if you search a bit: http://www.hookedonlinq.com/LINQtoXML5MinuteOverview.ashx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 144k
  • Answers 144k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer When you start the app for the very first time… May 12, 2026 at 8:34 am
  • Editorial Team
    Editorial Team added an answer This is generating two bytes (0F 31) directly into the… May 12, 2026 at 8:34 am
  • Editorial Team
    Editorial Team added an answer This is a problem you probably want to avoid solving.… May 12, 2026 at 8:34 am

Related Questions

The idea of storing connection strings in a data base is a perverse idea,
I feel like this might be a crazy question, and if anyone has a
First and foremost let me state that I know that accessing server side controls
I doubt this is possible, but I was curious if you could have more

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.