Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on a program that ideally would take user input from a text box (windows form application) and the code would identify an object and assign members to it (example: "the jacket is black" and the code would identify the object as jacket and give it an attribute of black). The code to identify the object and its attribute I can handle, but I have very little experience with storing data in a database or however the most efficient way would be to store this would be.

Also I would need to be able to have the code check if there is a "jacket" object already created and if not create the object as well as its attributes and if there is, it would simply add the attributes to the already existing class.

Thanks for any and all help.
Posted
Comments
Rahul Rajat Singh 7-Mar-12 0:46am    
What exactly you want to store? I mean you want to store user input string somewhere or you want to store the jacket data itself?
BboyTech 7-Mar-12 13:51pm    
The way I was thinking of approaching it was to have the jacket object actually be the name of a data table that could contain attributes like black, waterproof, etc...
being able to store the user input string would be nice to have in the program, but I want to tackle this issue which is more vital and not bite off more than I can chew.

Here's a more elaborate example (without going into the code of it):

user input: the jacket is black
//code to identify that the object is jacket and its "attribute" is black

//code to see if there is a data table named jacket in the database already
//if yes then checks to see if black is already a member of the data table
//if no then adds black as member of jacket
//if yes then doesn't re-add black and exits the loop that's running
//if no, creates the data table "jacket" with member "black" and exits loop

I am sorry if I switched between terms like member and attribute, I don't always write with perfect coding terminology.

Since you have little experience on the database part, you might want to start by learning ADO.Net[^].
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 7-Mar-12 1:24am    
Basically, your idea is good; and I voted 5.
However, I'm not 100% agree that it will provide sufficient help. ADO.NET manuals usually assume some prerequisites, such as understanding of OOP, and, essentially, some understanding of databases and relational model ideas.

So, I added my answer with some references, but that also might be not enough. Some people do not move on their own but require some cultural environment and guidance from others.
--SA
BboyTech 7-Mar-12 13:27pm    
Thanks walter, that's much appreciated point in the right direction.
In addition to what walterhevedeich advised, I would suggest you learn about the ideas of databases.

http://en.wikipedia.org/wiki/Database[^],
http://en.wikipedia.org/wiki/Database_management_system[^],
http://en.wikipedia.org/wiki/Binary_relation[^],
http://en.wikipedia.org/wiki/Relational_algebra[^],
http://en.wikipedia.org/wiki/Relational_model[^],
http://en.wikipedia.org/wiki/Relational_database[^],
http://en.wikipedia.org/wiki/Relational_database_management_system[^].

Maybe the encyclopedia cannot replace education, and you really need some pretty basic education, not just some concrete technical knowledge. At least these encyclopedia can show you the scope of required education. Also, it needs some practice of analyzing of real-life concepts and mapping them onto relational model.

Also, understanding of ADO.NET requires good understanding of OOP.
Only based on that, or in parallel with that, you can learn ADO.NET and get to using it practically.

Good luck,
—SA
 
Share this answer
 
v3
Comments
BboyTech 7-Mar-12 13:25pm    
I agree that I do have a lot I need to learn, and I am more than willing to. Just from all the different possible ways there are to store data, I wanted to be sure I learned the most efficient way to do this and not overpass the basics by trying to learn a system that is overly complex. And I'm not in anyway trying to be one of those people who just wants a quick answer, I do want to learn, and the best way I have found to do so (other than classes which are a bit costly at the time) is by reading as much as I can. And again thanks SA, these articles will help a lot
BboyTech 7-Mar-12 14:09pm    
This link's image in the first paragraph is exactly the kind of set up I was talking about: http://en.wikipedia.org/wiki/Database_management_system

Where the data table would be jacket instead of Employee and the information would just be "black" (from this single user input). Or possibly even have the jacket object have something like a labeled array called "color" as a member that when the user input signals that a color(black, red, green, etc) is an attribute of jacket that it is known as a color in general and is put into that array that is in the jacket data table.

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