Store Data in Executable File

TedN

Freshman
Joined
Sep 25, 2006
Messages
35
I'm new at this but I was wondering if data can be stored somehow within the executable file rather than in another DAT or TXT file.

For instance, if a user entered name, etc., into a textbox could this information be saved within the form(s) so that it is available next time the program was opened.

Alternatively, can a text file be incorporated into the executable file.

Thanks,
Ted
 
Thanks for your reply.

I'm not sure I know how to store data in the registry. Also, if the amount of data was large would the registry still be the best place

I've tried Add Existing Item in the Project menu and added a database record to the project. The record normally resides on my C drive so the connection string was:

con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = C:\Assign10.mdb"

which worked fine.

However, when I change it to:

con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = Assign10.mdb"

to reference the copy of the file I added to the project I get an error. The program can't locate it. Any ideas.

Thanks,
Ted
 
Depends what you consider a large amount of data.

I use the registry for program options and information.
I use it to store stuff like SQL Server, Database, user information, address, program options and settings, connection strings.

But if you mean large amounts of information like records then use a database.
 
You can not store dynamic data (i.e. data that can change) within an executable. Why are you opposed to using a file to store data?

I use the registry sometimes, but there are people who would tell you not to. The reasons are (1) the registry is not portable between operating systems, though this is not a problem for most users/programmers, and (2) if the application is installed onto a disk, thumb drive, etc., the settings will not be stored alongside the application, which means that the user will have to configure the application for each computer he uses it on.

The registry is more for setting/configuration data than other types of data, but if you do choose to use the registry, the registry classes are well documented on MSDN on the web (I know that the help files for Microsoft.Win32 classes are not installed on my local MSDN).

I personally recommend a database or a file. It can be less than convinient to have more than one file to distribute/copy/move but that's usually the way it has to be.
 
Back
Top