Click here to Skip to main content
13,897,175 members
Rate this:
Please Sign up or sign in to vote.
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
Updated 10-Nov-18 8:49am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.
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:

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.
Member 13822874 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web05 | 2.8.190306.1 | Last Updated 10 Nov 2018
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100