RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Visual Studio information handling help.

0 Members and 1 Guest are viewing this topic.

pokeball TDSOffline
***
Rep:
Level 84
-T D S-
Silver - GIAW 11 (Hard)Silver - Game In A Week VII
I'm going to start by explaining my goals;

I am trying to make a database sort program for a list of cards that are imported into a text file and converted using a ruby script. Each card has many unique properties such as: Name, Level, Life etc.

My problem starts when it comes to saving and loading the information, and that is where I would like some help.

I have made different versions of the program, all of which use XML for saving and loading card information between tags. The version which saves each card into a different XML file works great, but the version that saves all card information into a single file tends to crash a lot because of files being already open and "XmlDocument" does not have a closing method to close a file after use. I know that is how it was made to work and that the problem lies my faulty code, but I cannot fix it.

So, I wanted to know if anyone here knew how I could make a database where I could store objects or information for each card and save and load to populate the fields in the program whenever I needed it.

I am using Visual Studio 2010 to make the program.

Thank you for reading and have a nice day.

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
Try applying using clauses and see if that solves the problem.

Code: [Select]
using (xmlDocument)
{
    // Do stuff
}

I have made a snippet for helping saving xna games which you can study for reference: http://www.creationasylum.net/forum/index.php?showtopic=28156&st=0&p=333464&#entry333464
If this doesn't work let me know and I'll look into it more deeply.

If you really want to have a database then you can look into ADO.NET and LINQ, but from the usage you mention that will probalby to be overkill.

*hugs*
« Last Edit: October 08, 2011, 01:02:49 PM by Zeriab »

pokeball TDSOffline
***
Rep:
Level 84
-T D S-
Silver - GIAW 11 (Hard)Silver - Game In A Week VII
Thank you Zeriab.

I found a solution after trying to use "using" method, but sadly it required a close method for the object which xmldocument does not have.

I fixed it by using Try to catch the exception and try to save when the file was not opened.

**
Rep:
Level 82
"Using" statements only works on classes that interface IDisposable. XmlDocument does not, so that would not work.