Okay first of all thanks for taking the time to read this post. So I took a C# class this last spring semester and love programming with it now. The program I am working on I decided to make for my job that will help with scheduling.

Here's where the problem is that I am having. The program has saving and load for employee information that involves and object array (consisting of strings, int, booleans, and different type of arrays, I'll go over the details alittle farther down). The program also saves and load names for shift types and employee positions (it will also save the shift's to assign and all their info).

Now I have found a way to save but I feel like I am doing it all wrong. The info is saved to different .txt documents that are read and wrote to. The employee one looks like this

True,Test Employee 6,02/02/1920,90,Employee,Usher<>True Door<>False Concessions<>True Box<>False Glasses<>True

Here's how this is read (and written).
1) It reads until a comma is reached. each letter is stored in a string and then it checks to see if the world is true or false (it's stored as a boolean), this is for enabling or disabling an employee status (thinking if they go on long breaks)
2) After that it reads the next part till comma and its stored as a string. This is the employee's name
3) After the second comma it reads in the date of birth to a string (can be used to figure out the employee's age)
4) The next piece is stored as an int and is the employee's age (still following the whole comma thing)
5) Then the next part is stored as a string and is the employee's position (comma rule again)
6) And the last part is for knowing what shifts the employee can work and can't (reads in the name of the shift to a string then if it sees a "<" it checks the next character if it's ">" then it reading in the words after (these are stored as boolean and tell if the employee can work that shift type) and when it see a space it checks the next shift (these are stored in an object array that consists of a string and a boolean and the space increments the array)

Once the program detects the new line character it increments the employee object is incrmented. Okay so hopefully you have followed me so far.

Although this is a cleaver way of storing and loading data it's very ineffecient. The one problem is that if I change anything on any of the employees it has to pretty much overright the notepad document with a new blank one and then populate it. Well then it gets worse. For some reason everytime I read in the data I have excess array spaces of empty data (it has issues were it reads in return lines or something like that). Also if I remove an employee or edit I have to clear out the employee object array and then repopulate it by reading back in the file i just stored.

Also all those shift types if I change ones name or delete one (or add one) in another part of the program that does just that (I have no way of going threw the employee array and seeing if that shift exists in their line of code then delete it out or change its name or add it)

The other parts I said that save and load (shift types and employee positions) are purely a saved names in the text file.

So I have all these text files and I have a very inefficent way of loading and saving. So I assume databasing would allow me to change these individual elements without rewritting a file or having to use tons of code that is unneccesary.

FYI I have no clue how to use a database or anything so I can use all the help and such.

Hopefully this makes sense and thanks for the help (sorry I had to rush it ran out of time)

Eric's link is definitely a good one to start with. I would also recommend that you check out www.connectionstrings.com for when you're trying to figure out how to connect to your specific database. If when you're implementing your database stuff you have any questions, stop back and I'm sure many here would be glad to help out.

Okay now I got another question...how do i set up a database? I mean I have no clue how to even make one (i know sad I just know the word and how it might look but I have never used one in my life)

You can get a free SQL Server database from Microsoft thats small yet large enough for what you want, and integrates into Visual Studio. There are so many beginner SQL Server walk throughs Im not even sure which one to point you at first. If you have specific questions I will try to answer them.

Okay so is I want to use a SQL or like service and I was to give the program to another person this would involve me installing the databasing program right? also what is XML?

You have a few choices in databases. I recommend, as Chris does, that you get SQL Server Express. It's very easy to install and get up and running.

MySQL is also a good choice as it's free, open source, and works very very well, but the initial configuration can be a pain sometimes.

The last I would recommend, which is only a recommendation if you have MS Works or Office, is MS Access. I don't like it, in fact I hate it, but it's still usable and it's simple to setup new databases.

As for how to get another person to use your database enabled application, you'll have to make sure the other person has your choice installed, and build SQL scripts to set up the database in their installation. This is why MS Access is advantageous, as you can just ship that .mdb file with the executable and you're good to go, although the file can be changed rather easily.

So what about an excel document? can it be used like a database? in where I can select and alter only certain parts? Cause see the thing is the place I work for has a locked down computer. I can probably get them to allow me to make sure the newest version of .NET (v4 in this case) is installed but installing a Database might be hard. Also I will state this again, I just started programming C# this last spring (when I learned it). So I took a huge lead from a program that was maybe 500 - 1000 lines with a few forms and straight forward to this massive program that is thousands of lines of code and allows alot more free range on the user's side

Thank you sir, well I'll marked this solved as echnically my question was answered

This question has already been answered. Start a new discussion instead.