Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have written a couple of different projects with Visual Studio 2012. Each of the projects need to have at least 1 supporting data file. Currently (and I know this is wrong) I am using RANDOM access files to store the different types of data (boolean,string,integer) because I can access them very quickly. For now, it seems to work and my code runs like it should. Another thing, I am creating these files with the OLD "FileOpen" command (I know this is not current too!) but I don't understand how to use the better way. Can someone help me with these issues?

What I have tried:

I have no code to show at this time
Posted
Updated 10-Nov-18 8:49am

1 solution

Use a database - there are several - and they take the hard work out of it (as well as allowing multiuser access later if you need it)
They also provide a load of very useful features such as multiple tables and references which can reduce or remove data duplication as well.

Google for VB.NET database and you'll find classes for Access, Sql Server, Sqlite, and others.
 
Share this answer
 
Comments
kmoorevs 10-Nov-18 16:08pm    
Second this answer, just wanted to add another benefit for using a database is the security. If you are really stuck on using files, consider xml...easy to load/manipulate/save and can be queried with linq.
OriginalGriff 11-Nov-18 2:11am    
If you are storing just one of each value, then you don't need a DB, or even a random access file!
The simplest, cleanest, and clearest way to do it is to use a settings file:
https://docs.microsoft.com/en-us/visualstudio/ide/managing-application-settings-dotnet?view=vs-2017

But ... do look at databases at some point - they really aren't a lot of code, and they do provide a lot of flexibility and power in what you are doing with data.
[no name] 10-Nov-18 19:26pm    
Thank you both for your help. You are BOTH GREAT. I just have 1 problem, I don't know about either. I also don't want to write alot of code to get 1 or 2 values when I need to. Maybe it's time to quit doing something I'm not good at. Thank you again.

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